diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d525cfd1e..8f8eefc54 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Create Build Environment # Some projects don't allow in-source building, so create a separate build directory @@ -43,4 +43,4 @@ jobs: shell: bash # Execute tests defined by the CMake configuration. # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail - run: ctest -C $BUILD_TYPE + run: ctest -C $BUILD_TYPE --rerun-failed --output-on-failure diff --git a/.gitignore b/.gitignore index d6244bd7e..305a662db 100644 --- a/.gitignore +++ b/.gitignore @@ -55,3 +55,8 @@ tests/sm/crack0Step0.vtk tests/sm/crack1Step0.vtk tests/sm/crack2Step0.vtk tests/sm/t3d.bmf +/.vs/oofem/v17/Browse.VC.db +*.db-shm +*.db-wal +*.opendb +/.vs/oofem/v17/DocumentLayout.backup.json diff --git a/.vs/CMake Overview b/.vs/CMake Overview new file mode 100644 index 000000000..e69de29bb diff --git a/.vs/CMakeWorkspaceSettings.json b/.vs/CMakeWorkspaceSettings.json new file mode 100644 index 000000000..2c63c0851 --- /dev/null +++ b/.vs/CMakeWorkspaceSettings.json @@ -0,0 +1,2 @@ +{ +} diff --git a/.vs/ProjectSettings.json b/.vs/ProjectSettings.json new file mode 100644 index 000000000..8f0d73346 --- /dev/null +++ b/.vs/ProjectSettings.json @@ -0,0 +1,3 @@ +{ + "CurrentProjectSetting": "x64-Debug" +} \ No newline at end of file diff --git a/.vs/VSWorkspaceState.json b/.vs/VSWorkspaceState.json new file mode 100644 index 000000000..f35fcef9a --- /dev/null +++ b/.vs/VSWorkspaceState.json @@ -0,0 +1,12 @@ +{ + "OutputFoldersPerTargetSystem": { + "Local Machine": [ + "..\\oofem_Build2", + "..\\oofem_Build" + ] + }, + "ExpandedNodes": [ + "" + ], + "PreviewInSolutionExplorer": false +} \ No newline at end of file diff --git a/.vs/cmake.db b/.vs/cmake.db new file mode 100644 index 000000000..c8695eb07 Binary files /dev/null and b/.vs/cmake.db differ diff --git a/.vs/oofem/FileContentIndex/25da2479-f011-469d-912f-c905c015b4f4.vsidx b/.vs/oofem/FileContentIndex/25da2479-f011-469d-912f-c905c015b4f4.vsidx new file mode 100644 index 000000000..0416bee07 Binary files /dev/null and b/.vs/oofem/FileContentIndex/25da2479-f011-469d-912f-c905c015b4f4.vsidx differ diff --git a/.vs/oofem/FileContentIndex/3bcc0797-01ef-4684-b68c-0a7d90de375b.vsidx b/.vs/oofem/FileContentIndex/3bcc0797-01ef-4684-b68c-0a7d90de375b.vsidx new file mode 100644 index 000000000..c8cf93a49 Binary files /dev/null and b/.vs/oofem/FileContentIndex/3bcc0797-01ef-4684-b68c-0a7d90de375b.vsidx differ diff --git a/.vs/oofem/FileContentIndex/53f0dc39-7487-4a40-a8d7-72574d094da7.vsidx b/.vs/oofem/FileContentIndex/53f0dc39-7487-4a40-a8d7-72574d094da7.vsidx new file mode 100644 index 000000000..66aa35cb9 Binary files /dev/null and b/.vs/oofem/FileContentIndex/53f0dc39-7487-4a40-a8d7-72574d094da7.vsidx differ diff --git a/.vs/oofem/FileContentIndex/8a387f83-f563-4129-b293-041e9132a4ba.vsidx b/.vs/oofem/FileContentIndex/8a387f83-f563-4129-b293-041e9132a4ba.vsidx new file mode 100644 index 000000000..b4a91c233 Binary files /dev/null and b/.vs/oofem/FileContentIndex/8a387f83-f563-4129-b293-041e9132a4ba.vsidx differ diff --git a/.vs/oofem/FileContentIndex/b0b24e78-bba6-43c4-9a01-7da17b5c7ae7.vsidx b/.vs/oofem/FileContentIndex/b0b24e78-bba6-43c4-9a01-7da17b5c7ae7.vsidx new file mode 100644 index 000000000..6f98774d5 Binary files /dev/null and b/.vs/oofem/FileContentIndex/b0b24e78-bba6-43c4-9a01-7da17b5c7ae7.vsidx differ diff --git a/.vs/oofem/v17/.wsuo b/.vs/oofem/v17/.wsuo new file mode 100644 index 000000000..6790542aa Binary files /dev/null and b/.vs/oofem/v17/.wsuo differ diff --git a/.vs/oofem/v17/DocumentLayout.json b/.vs/oofem/v17/DocumentLayout.json new file mode 100644 index 000000000..6c5730d82 --- /dev/null +++ b/.vs/oofem/v17/DocumentLayout.json @@ -0,0 +1,90 @@ +{ + "Version": 1, + "WorkspaceRootPath": "C:\\Users\\CMourlas001\\source\\repos\\oofem\\", + "Documents": [ + { + "AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\CMourlas001\\source\\repos\\oofem\\src\\oofemlib\\hangingnode.C||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:src\\oofemlib\\hangingnode.C||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" + }, + { + "AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\CMourlas001\\source\\repos\\oofem\\src\\main\\main.C||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:src\\main\\main.C||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" + }, + { + "AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\CMourlas001\\source\\repos\\oofem\\CMakeLists.txt||{8B382828-6202-11D1-8870-0000F87579D2}", + "RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:CMakeLists.txt||{8B382828-6202-11D1-8870-0000F87579D2}" + }, + { + "AbsoluteMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|C:\\Users\\CMourlas001\\source\\repos\\oofem\\src\\oofemlib\\vtkxmlexportmodule.C||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}", + "RelativeMoniker": "D:0:0:{A2FE74E1-B743-11D0-AE1A-00A0C90FFFC3}|\u003CMiscFiles\u003E|solutionrelative:src\\oofemlib\\vtkxmlexportmodule.C||{D0E1A5C6-B359-4E41-9B60-3365922C2A22}" + } + ], + "DocumentGroupContainers": [ + { + "Orientation": 0, + "VerticalTabListWidth": 256, + "DocumentGroups": [ + { + "DockedWidth": 200, + "SelectedChildIndex": 3, + "Children": [ + { + "$type": "Bookmark", + "Name": "ST:0:0:{1c4feeaa-4718-4aa9-859d-94ce25d182ba}" + }, + { + "$type": "Document", + "DocumentIndex": 1, + "Title": "main.C", + "DocumentMoniker": "C:\\Users\\CMourlas001\\source\\repos\\oofem\\src\\main\\main.C", + "RelativeDocumentMoniker": "src\\main\\main.C", + "ToolTip": "C:\\Users\\CMourlas001\\source\\repos\\oofem\\src\\main\\main.C", + "RelativeToolTip": "src\\main\\main.C", + "ViewState": "AgIAAJAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000423|", + "WhenOpened": "2025-04-07T12:57:46.717Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 3, + "Title": "vtkxmlexportmodule.C", + "DocumentMoniker": "C:\\Users\\CMourlas001\\source\\repos\\oofem\\src\\oofemlib\\vtkxmlexportmodule.C", + "RelativeDocumentMoniker": "src\\oofemlib\\vtkxmlexportmodule.C", + "ToolTip": "C:\\Users\\CMourlas001\\source\\repos\\oofem\\src\\oofemlib\\vtkxmlexportmodule.C", + "RelativeToolTip": "src\\oofemlib\\vtkxmlexportmodule.C", + "ViewState": "AgIAAFoAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000423|", + "WhenOpened": "2025-04-07T12:51:33.388Z" + }, + { + "$type": "Document", + "DocumentIndex": 0, + "Title": "hangingnode.C", + "DocumentMoniker": "C:\\Users\\CMourlas001\\source\\repos\\oofem\\src\\oofemlib\\hangingnode.C", + "RelativeDocumentMoniker": "src\\oofemlib\\hangingnode.C", + "ToolTip": "C:\\Users\\CMourlas001\\source\\repos\\oofem\\src\\oofemlib\\hangingnode.C", + "RelativeToolTip": "src\\oofemlib\\hangingnode.C", + "ViewState": "AgIAAB4AAAAAAAAAAAAAAJMAAAAHAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000423|", + "WhenOpened": "2025-04-07T11:28:23.575Z", + "EditorCaption": "" + }, + { + "$type": "Document", + "DocumentIndex": 2, + "Title": "CMakeLists.txt", + "DocumentMoniker": "C:\\Users\\CMourlas001\\source\\repos\\oofem\\CMakeLists.txt", + "RelativeDocumentMoniker": "CMakeLists.txt", + "ToolTip": "C:\\Users\\CMourlas001\\source\\repos\\oofem\\CMakeLists.txt", + "RelativeToolTip": "CMakeLists.txt", + "ViewState": "AgIAABUAAAAAAAAAAAAAAH4AAAASAAAAAAAAAA==", + "Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.003109|", + "WhenOpened": "2024-10-09T22:21:10.591Z" + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/.vs/oofem/v17/Solution.VC.db b/.vs/oofem/v17/Solution.VC.db new file mode 100644 index 000000000..a3ad1db09 Binary files /dev/null and b/.vs/oofem/v17/Solution.VC.db differ diff --git a/.vs/oofem/v17/ipch/AutoPCH/3b3c6843e018a446/OOFEMCFG.ipch b/.vs/oofem/v17/ipch/AutoPCH/3b3c6843e018a446/OOFEMCFG.ipch new file mode 100644 index 000000000..ce6f4baf9 Binary files /dev/null and b/.vs/oofem/v17/ipch/AutoPCH/3b3c6843e018a446/OOFEMCFG.ipch differ diff --git a/.vs/oofem/v17/ipch/AutoPCH/56316d2e2636b9d9/OOFEMCFG.ipch b/.vs/oofem/v17/ipch/AutoPCH/56316d2e2636b9d9/OOFEMCFG.ipch new file mode 100644 index 000000000..729e18280 Binary files /dev/null and b/.vs/oofem/v17/ipch/AutoPCH/56316d2e2636b9d9/OOFEMCFG.ipch differ diff --git a/.vs/oofem/v17/ipch/AutoPCH/d22ad6e0575549b3/OOFEMCFG.ipch b/.vs/oofem/v17/ipch/AutoPCH/d22ad6e0575549b3/OOFEMCFG.ipch new file mode 100644 index 000000000..cb1612ed1 Binary files /dev/null and b/.vs/oofem/v17/ipch/AutoPCH/d22ad6e0575549b3/OOFEMCFG.ipch differ diff --git a/.vs/oofem/v17/workspaceFileList.bin b/.vs/oofem/v17/workspaceFileList.bin new file mode 100644 index 000000000..2fef469f1 Binary files /dev/null and b/.vs/oofem/v17/workspaceFileList.bin differ diff --git a/.vs/slnx.sqlite b/.vs/slnx.sqlite new file mode 100644 index 000000000..3f7a3b4f0 Binary files /dev/null and b/.vs/slnx.sqlite differ diff --git a/.vs/tasks.vs.json b/.vs/tasks.vs.json new file mode 100644 index 000000000..ef3b1c474 --- /dev/null +++ b/.vs/tasks.vs.json @@ -0,0 +1,10 @@ +{ + "version": "0.2.1", + "tasks": [ + { + "taskLabel": "task-oofem", + "appliesTo": "/", + "type": "launch" + } + ] +} \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 4828444d6..0cec1f59d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -110,11 +110,20 @@ option (USE_OOFEG "Enable OOFEG" OFF) option (USE_SHARED_LIB "Build shared library" ON) option (USE_MFRONT "Build shared library" OFF) +option (BUILD_EXTRA_BENCHMARKS "Build benchmark target" OFF) +mark_as_advanced(BUILD_EXTRA_BENCHMARKS) +option (BUILD_EXTRA_EXAMPLES "Build examples (beam2d_1)" OFF) +mark_as_advanced(BUILD_EXTRA_EXAMPLES) +option (BUILD_EXTRA_HEXGRID "Build hexgrid" OFF) +mark_as_advanced(BUILD_EXTRA_HEXGRID) +option (BUILD_EXTRA_DREAM3D "Build dream3d" OFF) +mark_as_advanced(BUILD_EXTRA_DREAM3D) + # Parallel stuff -option (USE_PARALLEL "Enable parallel support" OFF) +option (USE_MPI_PARALLEL "Enable MPI-based, distributed memory parallel support" OFF) option (USE_METIS "Enable metis support" OFF) option (USE_PARMETIS "Enable Parmetis support" OFF) -option (USE_OPENMP "Compile with OpenMP support (for parallel assembly)" OFF) +option (USE_OPENMP_PARALLEL "Enable OpenMP, shared memory parallelism" OFF) # Solvers and such option (USE_DSS "Enable DSS module" OFF) # No reason to use this option (USE_IML "Enable iml++ solvers" OFF) # or this @@ -144,8 +153,8 @@ option (USE_PYTHON_EXTENSION "Enable Python extension for exposing C++ code to p option (USE_HDF5 "HDF5 support" OFF) option (USE_MPM "Enable experimental multiphysics module" OFF) -if (USE_PARALLEL) - add_definitions (-D__PARALLEL_MODE) +if (USE_MPI_PARALLEL) + add_definitions (-D__MPI_PARALLEL_MODE) set (USE_MPI ON) endif () @@ -225,7 +234,7 @@ if (USE_DSS) list (APPEND MODULE_LIST "dss") endif () -if (USE_OPENMP) +if (USE_OPENMP_PARALLEL) include (FindOpenMP) if (OPENMP_FOUND) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") @@ -641,7 +650,7 @@ if (USE_PYBIND_BINDINGS) endif () include_directories (${pybind11_INCLUDE_DIR} ${Python_INCLUDE_DIRS}) list (APPEND EXT_LIBS ${Python_LIBRARIES}) - pybind11_add_module(oofempy THIN_LTO ${oofem_SOURCE_DIR}/bindings/python/oofem.cpp ${oofem_SOURCE_DIR}/src/oofemcfg.C ${PYBIND11_HEADERS}) + pybind11_add_module(oofempy THIN_LTO ${oofem_SOURCE_DIR}/bindings/python/oofem.cpp ${PYBIND11_HEADERS}) target_link_libraries(oofempy PRIVATE liboofem) set_target_properties (oofempy PROPERTIES SUFFIX "${PYTHON_MODULE_EXTENSION}") @@ -680,6 +689,10 @@ configure_file ( "${oofem_SOURCE_DIR}/src/oofemcfg.h.in" "${oofem_BINARY_DIR}/oofemcfg.h" ) +configure_file ( + "${oofem_SOURCE_DIR}/src/oofemenv.h.in" + "${oofem_BINARY_DIR}/oofemenv.h" +) ####################################################################### ######################## Targets ###################################### @@ -773,12 +786,12 @@ endif () # OOFEM target if (USE_SHARED_LIB) # Prefer dynamic lib if available. - add_executable (oofem ${oofem_SOURCE_DIR}/src/oofemcfg.C ${oofem_SOURCE_DIR}/src/main/main.C) + add_executable (oofem ${oofem_SOURCE_DIR}/src/main/main.C) add_dependencies(oofem version) target_link_libraries (oofem liboofem) else () - add_executable (oofem ${oofem_SOURCE_DIR}/src/oofemcfg.C ${oofem_SOURCE_DIR}/src/main/main.C ${LIBS}) + add_executable (oofem ${oofem_SOURCE_DIR}/src/main/main.C ${LIBS}) add_dependencies(oofem version) target_link_libraries (oofem ${EXT_LIBS}) @@ -794,10 +807,10 @@ endif () if (USE_OOFEG) # OOFEG target: if (USE_SHARED_LIB) - add_executable (oofeg ${oofem_SOURCE_DIR}/src/oofemcfg.C ${oofem_SOURCE_DIR}/src/main/oofeg.C) + add_executable (oofeg ${oofem_SOURCE_DIR}/src/main/oofeg.C) target_link_libraries (oofeg liboofem) else () - add_executable (oofeg ${oofem_SOURCE_DIR}/src/oofemcfg.C ${oofem_SOURCE_DIR}/src/main/oofeg.C ${LIBS}) + add_executable (oofeg ${oofem_SOURCE_DIR}/src/main/oofeg.C ${LIBS}) target_link_libraries (oofeg ${EXT_LIBS}) endif () install(TARGETS oofeg DESTINATION bin) @@ -805,24 +818,33 @@ if (USE_OOFEG) endif () -add_executable(liboofem_benchmark ${oofem_SOURCE_DIR}/src/oofemcfg.C ${oofem_SOURCE_DIR}/src/main/benchmark.C) -add_dependencies(liboofem_benchmark version) -set_target_properties(liboofem_benchmark PROPERTIES EXCLUDE_FROM_ALL TRUE) -target_link_libraries (liboofem_benchmark liboofem benchmark) +if (BUILD_EXTRA_BENCHMARKS) + find_package(benchmark REQUIRED) + add_executable(liboofem_benchmark ${oofem_SOURCE_DIR}/src/main/benchmark.C) + add_dependencies(liboofem_benchmark version) + set_target_properties(liboofem_benchmark PROPERTIES EXCLUDE_FROM_ALL TRUE) + target_link_libraries (liboofem_benchmark liboofem benchmark) +endif () -# Example of using liboofem with dynamic input record: -add_executable(beam2d_1 ${oofem_SOURCE_DIR}/src/oofemcfg.C ${oofem_SOURCE_DIR}/bindings/oofemlib/beam2d_1.C) -add_dependencies(beam2d_1 version) -set_target_properties(beam2d_1 PROPERTIES EXCLUDE_FROM_ALL TRUE) -target_link_libraries (beam2d_1 liboofem) +if (BUILD_EXTRA_EXAMPLES) + # Example of using liboofem with dynamic input record: + add_executable(beam2d_1 ${oofem_SOURCE_DIR}/bindings/oofemlib/beam2d_1.C) + add_dependencies(beam2d_1 version) + set_target_properties(beam2d_1 PROPERTIES EXCLUDE_FROM_ALL TRUE) + target_link_libraries (beam2d_1 liboofem) +endif () -add_executable(hexgrid ${oofem_SOURCE_DIR}/src/oofemcfg.C ${oofem_SOURCE_DIR}/bindings/oofemlib/hexgrid.C) -set_target_properties(hexgrid PROPERTIES EXCLUDE_FROM_ALL TRUE) -target_link_libraries (hexgrid liboofem) +if (BUILD_EXTRA_HEXGRID) + add_executable(hexgrid ${oofem_SOURCE_DIR}/bindings/oofemlib/hexgrid.C) + set_target_properties(hexgrid PROPERTIES EXCLUDE_FROM_ALL TRUE) + target_link_libraries (hexgrid liboofem) +endif () -add_executable(dream3d_analysis ${oofem_SOURCE_DIR}/src/oofemcfg.C ${oofem_SOURCE_DIR}/bindings/oofemlib/dream3d_analysis.C) -set_target_properties(dream3d_analysis PROPERTIES EXCLUDE_FROM_ALL TRUE) -target_link_libraries(dream3d_analysis liboofem) +if (BUILD_EXTRA_DREAM3D) + add_executable(dream3d_analysis ${oofem_SOURCE_DIR}/bindings/oofemlib/dream3d_analysis.C) + set_target_properties(dream3d_analysis PROPERTIES EXCLUDE_FROM_ALL TRUE) + target_link_libraries(dream3d_analysis liboofem) +endif () # CppCheck target (not built by default) add_custom_target(cppcheck) @@ -894,7 +916,7 @@ include (CTest) #set (CTEST_MEMORYCHECK_SUPPRESSIONS_FILE ${oofem_TEST_DIR}/tests/valgrind.supp) -if (USE_PARALLEL) +if (USE_MPI_PARALLEL) set (par_dir ${oofem_TEST_DIR}/partests) file (GLOB parallel_tests RELATIVE "${par_dir}" "${par_dir}/*/") foreach (case ${parallel_tests}) @@ -1027,7 +1049,7 @@ endif() if (N EQUAL 0) set (N 1) endif () -if (USE_OPENMP) # OPENMP will use all processors by default +if (USE_OPENMP_PARALLEL) # OPENMP will use all processors by default set (N 1) endif () diff --git a/CMakeSettings.json b/CMakeSettings.json new file mode 100644 index 000000000..52e924fb4 --- /dev/null +++ b/CMakeSettings.json @@ -0,0 +1,42 @@ +{ + "configurations": [ + { + "name": "x64-Debug", + "generator": "Visual Studio 17 2022 Win64", + "configurationType": "Debug", + "inheritEnvironments": [ "msvc_arm64_x64" ], + "buildRoot": "C:\\Users\\CMourlas001\\Source\\Repos\\oofem_Build2", + "intelliSenseMode": "windows-msvc-x64", + "cmakeCommandArgs": "C:\\Users\\CMourlas001\\Source\\Repos\\oofem_Build2", + "installRoot": "C:\\Users\\CMourlas001\\Source\\Repos\\oofem_Build2", + "variables": [ + { + "name": "CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL", + "value": "/INCREMENTAL:YES", + "type": "STRING" + }, + { + "name": "CMAKE_SHARED_LINKER_FLAGS_RELEASE", + "value": "/INCREMENTAL:YES", + "type": "STRING" + }, + { + "name": "USE_SHARED_LIB", + "value": "true", + "type": "BOOL" + } + ] + }, + { + "name": "x64-Release", + "generator": "Visual Studio 17 2022 Win64", + "configurationType": "Release", + "buildRoot": "C:\\Users\\CMourlas001\\Source\\Repos\\oofem_Build", + "installRoot": "C:\\Users\\CMourlas001\\Source\\Repos\\oofem_Build", + "cmakeCommandArgs": "", + "buildCommandArgs": "", + "ctestCommandArgs": "", + "inheritEnvironments": [ "msvc_x64_x64" ] + } + ] +} \ No newline at end of file diff --git a/bindings/oofemlib/dream3d_analysis.C b/bindings/oofemlib/dream3d_analysis.C index f8fdbfb77..ecf9cb684 100644 --- a/bindings/oofemlib/dream3d_analysis.C +++ b/bindings/oofemlib/dream3d_analysis.C @@ -3,6 +3,7 @@ #include "dynamicdatareader.h" #include "intarray.h" #include "floatarray.h" +#include "inputrecord.h" #include "timer.h" // Optional (only need the input fields defines) @@ -75,7 +76,7 @@ public: void giveRecordKeywordField(std :: string &answer) override { answer = "node"; } void giveField(FloatArray &answer, InputFieldType id) override { if (std::string(id) == _IFT_Node_coords) answer = coords; - else throw MissingKeywordInputException(this*, id, recordNumber); + else throw MissingKeywordInputException(*this, id, recordNumber); } bool hasField(InputFieldType id) override { return std::string(id) == _IFT_Node_coords; } @@ -96,7 +97,7 @@ public: void giveRecordKeywordField(std :: string &answer) override { answer = _IFT_Brick1_ht_Name; } void giveField(IntArray &answer, InputFieldType id) override { if (std::string(id) == _IFT_Element_nodes) answer = enodes; - else throw MissingKeywordInputException(this*, id, recordNumber); + else throw MissingKeywordInputException(*this, id, recordNumber); } bool hasField(InputFieldType id) override { return std::string(id) == _IFT_Element_nodes; } @@ -111,12 +112,12 @@ public: virtual void giveField(IntArray &answer, InputFieldType id) { if (std::string(id) == _IFT_Element_nodes) answer = enodes; - else throw MissingKeywordInputException(this*, id, recordNumber); + else throw MissingKeywordInputException(*this, id, recordNumber); } virtual void giveField(int &answer, InputFieldType id) { if (std::string(id) == _IFT_Element_activityTimeFunction) answer = 2; else if (std::string(id) == _IFT_Element_nip) answer = 0; - else throw MissingKeywordInputException(this*, id, recordNumber); + else throw MissingKeywordInputException(*this, id, recordNumber); } virtual bool hasField(InputFieldType id) { return std::string(id) == _IFT_Element_activityTimeFunction || std::string(id) == _IFT_Element_nip || std::string(id) == _IFT_Element_nodes; } @@ -155,7 +156,7 @@ IntArray read_int_dataset(const DataSet &d) int main(int argc, char *argv[]) { -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE #ifdef __USE_MPI int rank; MPI_Init(& argc, & argv); diff --git a/bindings/oofemlib/hexgrid.C b/bindings/oofemlib/hexgrid.C index a388ba87d..381b09a82 100644 --- a/bindings/oofemlib/hexgrid.C +++ b/bindings/oofemlib/hexgrid.C @@ -63,7 +63,7 @@ std :: vector< inclusion > getInclusionsInBox(FloatArray corner, double rveSize, int main(int argc, char *argv[]) { -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE #ifdef __USE_MPI int rank; MPI_Init(& argc, & argv); diff --git a/bindings/python/examples/vtkdemo.py b/bindings/python/examples/vtkdemo.py index 1eb1c7fea..10a14fddb 100644 --- a/bindings/python/examples/vtkdemo.py +++ b/bindings/python/examples/vtkdemo.py @@ -15,13 +15,13 @@ print ("Piece:", p) print(p.getVertices()) print(p.getCellConnectivity()) - print(p.getCellTypes(vtkxmlPy)) + print(p.getCellTypes()) disp = p.getPrimaryVertexValues(oofempy.UnknownType.DisplacementVector) sig = p.getInternalVertexValues(oofempy.InternalStateType.IST_StressTensor) sigx = sig[:, 0] - grid = pv.UnstructuredGrid(p.getCellConnectivity(), p.getCellTypes(vtkxmlPy), p.getVertices()) - grid.point_arrays['Sigma_xx'] = sigx + grid = pv.UnstructuredGrid(p.getCellConnectivity(), p.getCellTypes(), p.getVertices()) + grid.point_data['Sigma_xx'] = sigx grid['Disp'] = disp print(grid.active_vectors) warped = grid.warp_by_vector('Disp', factor=1000.) diff --git a/bindings/python/oofem.cpp b/bindings/python/oofem.cpp index 8380985b7..395842587 100644 --- a/bindings/python/oofem.cpp +++ b/bindings/python/oofem.cpp @@ -39,6 +39,7 @@ namespace py = pybind11; #include +#include "oofemenv.h" #include "oofemcfg.h" #include "floatarray.h" #include "floatmatrix.h" @@ -102,10 +103,18 @@ namespace py = pybind11; #include "uniformgridfield.h" #include "unstructuredgridfield.h" +#include "vtkhdf5reader.h" #include "dofmanvalfield.h" #include "pythonfield.h" #include #include "oofemutil.h" + +#ifdef __MPM_MODULE + // mpm experimental + #include "integral.h" + #include "mpm.h" +#endif + #ifdef _OPENMP #include #endif @@ -181,6 +190,9 @@ template class PyElement : public PyFemComp oofem::MaterialMode giveMaterialMode() override { PYBIND11_OVERLOAD (oofem::MaterialMode, ElementBase, giveMaterialMode,); } + oofem::Element_Geometry_Type giveGeometryType() const override { + PYBIND11_OVERLOAD_PURE (oofem::Element_Geometry_Type, ElementBase, giveGeometryType,); + } const char *giveClassName() const override { PYBIND11_OVERLOAD_PURE (const char*, ElementBase, giveClassName,); } @@ -496,7 +508,7 @@ template class PyElement : public PyFemComp void giveInputRecord(oofem::DynamicInputRecord &input) override { PYBIND11_OVERLOAD(void, StructuralMaterialBase, giveInputRecord, input); } - void giveStiffnessMatrix(oofem::FloatMatrix &answer, oofem::MatResponseMode mode, oofem::GaussPoint *gp, oofem::TimeStep *tStep) override { + void giveStiffnessMatrix(oofem::FloatMatrix &answer, oofem::MatResponseMode mode, oofem::GaussPoint *gp, oofem::TimeStep *tStep) const override { PYBIND11_OVERLOAD(void, StructuralMaterialBase, giveStiffnessMatrix, std::ref(answer), mode, gp, tStep); } void giveRealStressVector (oofem::FloatArray &answer, oofem::GaussPoint *gp, const oofem::FloatArray &reducedStrain, oofem::TimeStep *tStep) override { @@ -970,6 +982,9 @@ PYBIND11_MODULE(oofempy, m) { .def("giveNumberOfDomainEquations", &oofem::EngngModel::giveNumberOfDomainEquations) .def("Instanciate_init", &oofem::EngngModel::Instanciate_init) .def_property("ndomains", &oofem::EngngModel::getNumberOfDomains, &oofem::EngngModel::setNumberOfDomains) + #ifdef __MPM_MODULE + .def("addIntegral", &oofem::EngngModel::py_addIntegral, py::keep_alive<0, 1>()) + #endif ; py::class_(m, "StaggeredProblem") @@ -1301,7 +1316,45 @@ PYBIND11_MODULE(oofempy, m) { .def("printYourself", &oofem::SparseMtrx::printYourself) ; + py::class_(m, "SparseLinearSystemNM") + .def("solve", (oofem::ConvergedReason (oofem::SparseLinearSystemNM::*) (SparseMtrx &A, FloatArray &b, FloatArray &x)) &oofem::SparseLinearSystemNM::solve) + ; + +#ifdef __MPM_MODULE + /* MPM stuff (experimental)*/ + + py::enum_(m, "VariableType") + .value("scalar", oofem::Variable::VariableType::scalar) + .value("vector", oofem::Variable::VariableType::vector) + ; + py::enum_(m, "VariableQuantity") + .value("Displacement", oofem::Variable::VariableQuantity::Displacement) + .value("Temperature", oofem::Variable::VariableQuantity::Temperature) + .value("Pressure", oofem::Variable::VariableQuantity::Pressure) + .value("VolumeFraction", oofem::Variable::VariableQuantity::VolumeFraction) + ; + + py::class_(m,"FEInterpolation") + ; + py::class_(m, "Variable") + .def(py::init()) // , py::arg("dual")=NULL + .def_readonly("dofIDs", &oofem::Variable::dofIDs) + .def_readonly("type", &oofem::Variable::type) + .def_readonly("q", &oofem::Variable::q) + ; + + py::class_(m, "Term") + ; + + py::class_(m, "Integral") + .def(py::init()) + .def("initialize", &oofem::Integral::initialize) + .def("assemble_lhs", &oofem::Integral::assemble_lhs) + .def("assemble_rhs", &oofem::Integral::assemble_rhs) + ; + /* end mpm experimental */ +#endif py::class_(m, "ClassFactory") .def("createElement", &oofem::ClassFactory::createElement) .def("createEngngModel", &oofem::ClassFactory::createEngngModel) @@ -1632,6 +1685,22 @@ PYBIND11_MODULE(oofempy, m) { .value("IntSource_wh", oofem::MatResponseMode::IntSource_wh) ; + py::enum_(m, "MaterialMode") + .value("_Unknown", oofem::MaterialMode::_Unknown) + .value("_3dMat", oofem::MaterialMode::_3dMat) + .value("_PlaneStress", oofem::MaterialMode::_PlaneStress) + .value("_PlaneStrain", oofem::MaterialMode::_PlaneStrain) + .value("_1dMat", oofem::MaterialMode::_1dMat) + .value("_1dHeat", oofem::MaterialMode::_1dHeat) + .value("_2dHeat", oofem::MaterialMode::_2dHeat) + .value("_3dHeat", oofem::MaterialMode::_3dHeat) + .value("_2dUP", oofem::MaterialMode::_2dUP) + .value("_3dUP", oofem::MaterialMode::_3dUP) + .value("_2dUPV", oofem::MaterialMode::_2dUPV) + .value("_3dUPV", oofem::MaterialMode::_3dUPV) + ; + + py::enum_(m,"TimeDiscretizationType") .value("TD_Unspecified", oofem::TimeDiscretizationType::TD_Unspecified) .value("TD_ThreePointBackward", oofem::TimeDiscretizationType::TD_ThreePointBackward) @@ -1641,8 +1710,17 @@ PYBIND11_MODULE(oofempy, m) { .value("TD_Explicit", oofem::TimeDiscretizationType::TD_Explicit) ; + py::enum_(m, "ConvergedReason") + .value("CR_UNKNOWN", oofem::ConvergedReason::CR_UNKNOWN) + .value("CR_CONVERGED", oofem::ConvergedReason::CR_CONVERGED) + .value("CR_DIVERGED_ITS", oofem::ConvergedReason::CR_DIVERGED_ITS) + .value("CR_DIVERGED_TOL", oofem::ConvergedReason::CR_DIVERGED_TOL) + .value("CR_FAILED", oofem::ConvergedReason::CR_FAILED) + ; + m.def("linearStatic", &linearStatic, py::return_value_policy::move); m.def("staticStructural", &staticStructural, py::return_value_policy::move); + m.def("dummyProblem", &dummyProblem, py::return_value_policy::move); m.def("domain", &domain, py::return_value_policy::move); m.def("truss1d", &truss1d, py::return_value_policy::move); m.def("beam2d", &beam2d, py::return_value_policy::move); @@ -1681,15 +1759,26 @@ PYBIND11_MODULE(oofempy, m) { m.def("homExport", &homExport, py::return_value_policy::move); m.def("createSet", &createSet, py::return_value_policy::move); +#ifdef __MPM_MODULE + // mpm experimental + m.def("skyline", &skyline, py::return_value_policy::move); + m.def("ldltfactorization", &ldltFactorization, py::return_value_policy::move); + m.def("q1", &q1, py::return_value_policy::move); + m.def("l1", &l1, py::return_value_policy::move); + + m.def("fei2dquadlin", &fei2dquadlin, py::return_value_policy::move); + m.def("fei2dlinelin", &fei2dlinelin, py::return_value_policy::move); + m.def("linearinterpolation", &linearinterpolation, py::return_value_policy::move); + m.def("BTSigmaTerm", &BTSigma_Term, py::return_value_policy::move); + m.def("NTfTerm", &NTf_Term, py::return_value_policy::move); + + m.def("upm", &upm, py::return_value_policy::move); +#endif //std::shared_ptr py::class_>(m, "Field") .def(py::init()) -// .def("evaluateAt", (int (oofem::Field::*)(oofem::FloatArray &answer, const oofem::FloatArray &coords, oofem::ValueModeType mode, oofem::TimeStep *tStep)) &oofem::Field::evaluateAt) - - .def("evaluateAt", [](oofem::FloatArray &answer, const oofem::FloatArray &coords, oofem::ValueModeType mode, oofem::TimeStep *tStep){ - return std::make_tuple(answer,coords);//TODO-how to invoke the function if it does not exist yet? - }) + .def("evaluateAt", (int (oofem::Field::*)(oofem::FloatArray &answer, const oofem::FloatArray &coords, oofem::ValueModeType mode, oofem::TimeStep *tStep)) &oofem::Field::evaluateAt) .def("giveType", &oofem::Field::giveType) .def("setType", &oofem::Field::setType) ; @@ -1715,6 +1804,13 @@ PYBIND11_MODULE(oofempy, m) { .def("getNodeCoordinates", &oofem::DofManValueField::getNodeCoordinates ) ; + py::class_(m, "VTKHDF5Reader") + .def(py::init<>()) + .def("initialize", &oofem::VTKHDF5Reader::initialize) + .def("finalize", &oofem::VTKHDF5Reader::finalize) + .def("readMesh", &oofem::VTKHDF5Reader::readMesh) + .def("readField", &oofem::VTKHDF5Reader::readField) + ; //depends on Python.h #ifdef _PYBIND_BINDINGS @@ -1725,6 +1821,24 @@ PYBIND11_MODULE(oofempy, m) { ; #endif - +// Utility function to test presence of compiled oofem modules + m.def("hasModule", [](const std::string &name) { +#ifdef __SM_MODULE + if (name == "sm") return true; +#endif +#ifdef __TM_MODULE + if (name == "tm") return true; +#endif +#ifdef __FM_MODULE + if (name == "fm") return true; +#endif +#ifdef __AM_MODULE + if (name == "am") return true; +#endif +#ifdef __MPM_MODULE + if (name == "mpm") return true; +#endif + return false; + }); m.def("test", &test); } diff --git a/bindings/python/oofemutil.h b/bindings/python/oofemutil.h index d98a313b4..76a90aa6c 100644 --- a/bindings/python/oofemutil.h +++ b/bindings/python/oofemutil.h @@ -15,6 +15,15 @@ namespace py = pybind11; #include "set.h" +#include "feinterpol.h" +#include "fei2dquadlin.h" +#include "skyline.h" +#include "ldltfact.h" + +#ifdef __MPM_MODULE +#include "prototype2.h" +#endif + #ifdef _MSC_VER #define strncasecmp _strnicmp #define strcasecmp _stricmp @@ -153,9 +162,10 @@ py::object createEngngModelOfType(const char* type, py::args args, py::kwargs kw engngm->initializeFrom(ir); if ( ir.hasField(_IFT_EngngModel_nmsteps) ) { - oofem::OOFEM_LOG_ERROR("engngModel: simulation with metasteps is not (yet) supported in Python"); + oofem::OOFEM_LOG_ERROR("engngModel: simulation with metasteps is not (yet) supported in Python"); } else { - engngm->instanciateDefaultMetaStep(ir); + engngm->instanciateDefaultMetaStep(ir); + //engngm->giveTimeStepController()->instanciateDefaultMetaStep(ir); } engngm->Instanciate_init(); @@ -174,6 +184,7 @@ py::object staticStructural(py::args args, py::kwargs kw) { return createEngngMo py::object transientTransport(py::args args, py::kwargs kw) { return createEngngModelOfType("transienttransport", args, kw); } +py::object dummyProblem(py::args args, py::kwargs kw) { return createEngngModelOfType("dummy", args, kw); } /***************************************************** @@ -190,7 +201,9 @@ py::object domain(py::args args, py::kwargs kw) d->setDomainType(dType); // output manager record oofem::OOFEMTXTInputRecord omir = makeOutputManagerOOFEMTXTInputRecordFrom(kw); - d->giveOutputManager()->initializeFrom(omir); + if ( !engngModel->giveSuppressOutput() ) { + d->giveOutputManager()->initializeFrom(omir); + } py::object ret = py::cast(d.release()); /* ???????????????????? // sets the last created domain as default one for furtherscript @@ -242,6 +255,10 @@ py::object lspace(py::args args, py::kwargs &kw) { return createElementOfType("l py::object tr1ht(py::args args, py::kwargs &kw) { return createElementOfType("tr1ht",args,kw); } py::object quad1ht(py::args args, py::kwargs &kw) { return createElementOfType("quad1ht",args,kw); } py::object qquad1ht(py::args args, py::kwargs &kw) { return createElementOfType("qquad1ht",args,kw); } +// mpm experimental +py::object q1(py::args args, py::kwargs &kw) { return createElementOfType("q1",args,kw); } +py::object l1(py::args args, py::kwargs &kw) { return createElementOfType("l1",args,kw); } + @@ -326,6 +343,7 @@ py::object idm1(py::args args, py::kwargs kw) { return createMaterialOfType("idm py::object isoHeat(py::args args, py::kwargs kw) { return createMaterialOfType("isoheat",args,kw); } py::object j2mat(py::args args, py::kwargs kw) { return createMaterialOfType("j2mat",args,kw); } py::object steel1(py::args args, py::kwargs kw) { return createMaterialOfType("steel1",args,kw); } +py::object upm(py::args args, py::kwargs kw) { return createMaterialOfType("upm",args,kw); } /***************************************************** @@ -403,3 +421,84 @@ py::object createSetOfType(const char* type, py::args args, py::kwargs kw) } py::object createSet(py::args args, py::kwargs kw) { return createSetOfType("set",args,kw); } + + +/****************************************************** + * Interpolations +*******************************************************/ +py::object createInterpolationOfType(std::string type, py::args args, py::kwargs kw) +{ + if (type == "fei2dquadlin") { + int i1 = len(args)>0?PyLong_AsUnsignedLong(args[0].ptr()):1; + int i2 = len(args)>0?PyLong_AsUnsignedLong(args[1].ptr()):2; + std::unique_ptr interpol = std::make_unique(i1,i2); + return py::cast(interpol.release()); + } else if (type == "fei2dlinelin") { + int i1 = len(args)>0?PyLong_AsUnsignedLong(args[0].ptr()):1; + int i2 = len(args)>0?PyLong_AsUnsignedLong(args[1].ptr()):2; + std::unique_ptr interpol = std::make_unique(i1,i2); + return py::cast(interpol.release()); + } +#ifdef __MPM_MODULE + else if (type == "linearinterpolation") { + std::unique_ptr interpol = std::make_unique(); + return py::cast(interpol.release()); + } +#endif + return py::none(); +} + +py::object fei2dquadlin(py::args args, py::kwargs kw) { return createInterpolationOfType("fei2dquadlin",args,kw); } +py::object fei2dlinelin(py::args args, py::kwargs kw) { return createInterpolationOfType("fei2dlinelin",args,kw); } +py::object linearinterpolation(py::args args, py::kwargs kw) { return createInterpolationOfType("linearinterpolation",args,kw); } + + +/****************************************************** + * Terms +*******************************************************/ +#ifdef __MPM_MODULE +#include "prototype2.h" +py::object createTermOfType(std::string type, py::args args, py::kwargs kw) +{ + if (type == "BTSigmaTerm") { + if (len(args)>2) { + oofem::Variable & f = args[0].cast(); + oofem::Variable & tf = args[1].cast(); + oofem::MaterialMode m = args[2].cast() ; + std::unique_ptr t = std::make_unique(f, tf, m); + return py::cast(t.release()); + } + } else if (type == "NTfTerm") { + if (len(args)>2) { + oofem::Variable & f = args[0].cast(); + oofem::Variable & tf = args[1].cast(); + oofem::MaterialMode m = args[2].cast() ; + std::unique_ptr t = std::make_unique(f, tf, m); + return py::cast(t.release()); + } + } + return py::none(); +} + +py::object BTSigma_Term(py::args args, py::kwargs kw) { return createTermOfType("BTSigmaTerm",args,kw); } +py::object NTf_Term(py::args args, py::kwargs kw) { return createTermOfType("NTfTerm",args,kw); } + +#endif + +/************************************************************ + * Sparse matrices +*************************************************************/ +py::object skyline() { + std::unique_ptr t = std::make_unique(); + return py::cast(t.release()); +} + +/************************************************************ + * Linear sparse solvers +*************************************************************/ +py::object ldltFactorization(py::args args, py::kwargs kw) { + oofem::Domain* domain = len(args)>0? args[0].cast() : nullptr; + oofem::EngngModel *emodel = len(args)>1? args[1].cast() : nullptr; + std::unique_ptr t = std::make_unique(domain, emodel); + return py::cast(t.release()); +} \ No newline at end of file diff --git a/bindings/python/tests/test_8.py b/bindings/python/tests/test_8.py new file mode 100644 index 000000000..e73bf54a1 --- /dev/null +++ b/bindings/python/tests/test_8.py @@ -0,0 +1,102 @@ +# +# Demo code to illustrate new mpm symbolic concept +# Requires oofempy compiled with __MPM_MODULE ON +# +# + +import sys +sys.path.extend(['/home/bp/devel/oofem.git/build', '/home/bp/devel/oofem.git/bindings/python']) +import oofempy +import util +import numpy as np +import pyvista as pv + + + +def test_8(): + # Requires oofempy compiled with __MPM_MODULE ON + import sys + sys.path.extend(['/home/bp/devel/oofem.git/build', '/home/bp/devel/oofem.git/bindings/python']) + import oofempy + import util + + + + # Create a new dummy problem (placeholder for our demo) with one domain. + problem = oofempy.dummyProblem(nSteps=1, outFile='test_7.out') + domain = oofempy.domain(1, 1, problem, oofempy.domainType._HeatTransferMode, tstep_all=1, dofman_all=0, element_all=0) + problem.setDomain(1, domain, True) + + # Define nodes + n1 = oofempy.node(1, domain, coords=(0, 0, 0. )) + n2 = oofempy.node(2, domain, coords=(1., 0.0, 0. )) + n3 = oofempy.node(3, domain, coords=(1., 1., 0. )) + n4 = oofempy.node(4, domain, coords=(0, 1, 0. )) + + # Defdine elements, note that q1 defines just element geometry. + q1 = oofempy.q1(1, domain, nodes=(1,2,3,4), mat=1, crossSect=1) # quad element #1 + l1 = oofempy.l1(2, domain, nodes=(2,3), mat=1, crossSect=1) # boundary element #2 + + # Dirichlet Boundary conditions + bc1 = oofempy.boundaryCondition(1, domain, loadTimeFunction=1, dofs=(1,2), values=(0.,0.), set=1) + bc2 = oofempy.boundaryCondition(2, domain, loadTimeFunction=1, dofs=(1,), values=(0.,), set=2) + # material and cross section + mat = oofempy.isoLE(1, domain, d=1., e=1., n=0.3, talpha=1.) + cs = oofempy.simpleCS(1, domain, mat=1, thickness=1.0) + # time functions + ltf1 = oofempy.constantFunction(1, domain, f_t=1.0) + # some sets (groups of nodes and elements) for later use + s1 = oofempy.createSet(1, domain, nodes=(1,)) + s2 = oofempy.createSet(2, domain, nodes=(4,)) + s3 = oofempy.createSet(3, domain, elements=(1,)) + bs1 = oofempy.createSet(4, domain, elements=(2,)) + util.setupDomain(domain, nodes=(n1,n2,n3,n4), elems=(q1,l1), css=(cs,), mats=(mat,), bcs=(bc1,bc2), ics=(), ltfs=(ltf1,), sets=(s1,s2,s3,bs1)) + + + interpolation = oofempy.linearinterpolation() + w= u = oofempy.Variable(interpolation, oofempy.VariableQuantity.Displacement, oofempy.VariableType.vector, 2, [1,2], None) + mt = oofempy.BTSigmaTerm(w, u, oofempy.MaterialMode._PlaneStress) + lt = oofempy.NTfTerm(w, u, oofempy.MaterialMode._PlaneStress) + tstep = problem.giveNextStep() + + + I1 = oofempy.Integral(domain, s3, mt) + problem.addIntegral(I1) + I1.initialize() + + I2 = oofempy.Integral(domain, bs1, lt) + I2.initialize() + + problem.postInitialize() + problem.forceEquationNumbering() + + + lhs=oofempy.skyline() + lhs.buildInternalStructure(problem, 1, oofempy.EModelDefaultEquationNumbering()); + I1.assemble_lhs(lhs, oofempy.EModelDefaultEquationNumbering(), tstep) + lhs.printYourself() + + + rhs = oofempy.FloatArray(5) + + I2.assemble_rhs(rhs, oofempy.EModelDefaultEquationNumbering(), tstep) + rhs.printYourself() + + r = oofempy.FloatArray(5) + linsolv = oofempy.ldltfactorization(domain, problem) + linsolv.solve(lhs, rhs, r) + print ("Displacement vector = ", r) + + assert (round (r[0]-1.0, 4) == 0), "Displacement at node 2, check failed" + assert (round (r[1]-0.0, 4) == 0), "Displacement at node 2, check failed" + assert (round (r[2]-1.0, 4) == 0), "Displacement at node 3, check failed" + assert (round (r[3]+0.3, 4) == 0), "Displacement at node 3, check failed" + assert (round (r[4]+0.3, 4) == 0), "Displacement at node 4, check failed" + + +if __name__ == "__main__": + if oofempy.hasModule('mpm'): + test_8() + else: + print("This example requires mpm module.") + print("Please recompile oofem with mpm module enabled.") diff --git a/cmake/Modules/GenerateVersion.cmake b/cmake/Modules/GenerateVersion.cmake index c9921399e..fee00bd50 100644 --- a/cmake/Modules/GenerateVersion.cmake +++ b/cmake/Modules/GenerateVersion.cmake @@ -6,6 +6,7 @@ find_package(Git) add_custom_target(version ${CMAKE_COMMAND} -D SRC=${CMAKE_SOURCE_DIR}/src/oofem_version.h.in -D DST=${CMAKE_BINARY_DIR}/oofem_version.h + -D OOFEM_SRC_DIR=${CMAKE_SOURCE_DIR} -D GIT_EXECUTABLE=${GIT_EXECUTABLE} -P ${CMAKE_SOURCE_DIR}/src/GenerateVersionHeader.cmake ) \ No newline at end of file diff --git a/doc/developerGuide/Makefile b/doc/developerGuide/Makefile new file mode 100644 index 000000000..055bda1d3 --- /dev/null +++ b/doc/developerGuide/Makefile @@ -0,0 +1,28 @@ +# Minimal makefile for Sphinx documentation +# + +# You can set these variables from the command line, and also +# from the environment for the first two. +SPHINXOPTS ?= +SPHINXBUILD ?= sphinx-build +SOURCEDIR = . +BUILDDIR = _build + +# Put it first so that "make" without argument is like "make help". +help: + @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) + +.PHONY: help Makefile + +www-install: +ifdef INSTALLDIR + cd _build; $(RCP) -r html $(INSTALLDIR)/resources/doc/developperGuide + cd _build; $(RCP) -r latex/OOFEMDeveloperguide.pdf $(INSTALLDIR)/resources/doc/developerguide +else + echo "INSTALLDIR not defined" +endif + +# Catch-all target: route all unknown targets to Sphinx using the new +# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). +%: Makefile + @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) diff --git a/doc/developerGuide/about.rst b/doc/developerGuide/about.rst new file mode 100644 index 000000000..bd784435b --- /dev/null +++ b/doc/developerGuide/about.rst @@ -0,0 +1,34 @@ +About +===== + + This manual is part of OOFEM documentation project. OOFEM is open source finite element solver which has been originally developped at + Department of Mechanics of Faculty of Civil Engineering, Czech Technical University in Prague, Czech Republic. + + For more information about oofem, please visit https://www.oofem.org + + +Legal notice +-------------- +This notice must be preserved on all partial or complete copies +of this manual. All modifications to this manual, translations or +derivative work based on this manual must be first approved in writing +by the author. If part of this manual is distributed, a notice how to +obtain the full version must be included. + +:: + + The OOFEM is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +Copyright (C) 1995-2024 Bořek Patzák \ No newline at end of file diff --git a/doc/developerGuide/coding_standards.rst b/doc/developerGuide/coding_standards.rst new file mode 100644 index 000000000..cc3b971fe --- /dev/null +++ b/doc/developerGuide/coding_standards.rst @@ -0,0 +1,51 @@ +Coding Standards +================ + +Naming Conventions +------------------ + +The names of classes, attributes, services, variables, and functions +in a program serve as comments of a sort. So don't choose terse names--instead, look for names that give useful information about the meaning of the variable or function. In a OOFEM +program, names should be English, like other comments. + +Local variable names can be shorter, because they are used only within one context, where (presumably) comments explain +their purpose. + +Try to limit your use of abbreviations in symbol names. It is ok to make a few abbreviations, explain what they mean, and +then use them frequently, but don't use lots of obscure abbreviations. + +Please use capital letters to separate words in a name. Stick to +lower case; reserve upper case for macros, and for name-prefixes that +follow a uniform convention. The function or service name should always begin with lovercase +letter, the first uppercase letter in function name indicates, that +function is returning newly allocated pointer, which has to be dealocated. +For example, you should use names like ignoreSpaceChangeFlag; + +When you want to define names with constant integer values, use enum rather than `#define`. GDB knows about +enumeration constants. + +Use descriptive file names. The class declarations should be placed in *.h files +and class implementation in corresponding *.C files. For each class, create a separate files. + + +Parameters and Return Values +----------------------------- + +The prefered argunent passing method for objects is by reference. +Try to avoid rerturning pointers to arrays or matrices (or generally +to any component), since it is not clear, whether to delocate the +returned pointer or not. The most prefered way is to create local +variable of vector or matrix type, pass it (using reference) to called +function. The calling function is responsible to properly resize the +(output) parameter and set values accordingly. The point is, that +destructors are called for local variables automatically by compiler, +so there is no possibility for memory leaks and the local variable can +be reused for multiple calls to target function (inside loop) and +therefore there is no need for repeating memory allocation and +dealocation. Sometimes it may be reasonable to return pointer to +constant float array or matrix (representing for example +nodal coordinates), since passing output array as parametr will require +array copying. + + + \ No newline at end of file diff --git a/doc/developerGuide/conf.py b/doc/developerGuide/conf.py new file mode 100644 index 000000000..dfd3e8368 --- /dev/null +++ b/doc/developerGuide/conf.py @@ -0,0 +1,27 @@ +# Configuration file for the Sphinx documentation builder. +# +# For the full list of built-in configuration values, see the documentation: +# https://www.sphinx-doc.org/en/master/usage/configuration.html + +# -- Project information ----------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information + +project = 'OOFEM Developer guide' +copyright = '2024, Bořek Patzák, Martin Horák' +author = 'Bořek Patzák, Martin Horák' + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +extensions = [] + +templates_path = ['_templates'] +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + + + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +html_theme = 'classic' +html_static_path = ['_static'] diff --git a/doc/developerGuide/dofmanagers.rst b/doc/developerGuide/dofmanagers.rst new file mode 100644 index 000000000..d318ab0c1 --- /dev/null +++ b/doc/developerGuide/dofmanagers.rst @@ -0,0 +1,250 @@ +DofManagers, DOFs, Boundary and Initial conditions +========================================================= + +Degrees of Freedom +------------------- +Abstract class `Dof` is provided and it represents abstraction for Degree Of Freedom (DOF) in finite element mesh. +DOFs are possessed by DofManagers (i.e, nodes, element sides or whatever) and +one `Dof` instance can belong to only one `DofManager` instance. +`Dof` maintain its physical meaning and reference to +related DofManager (reference to DofManager which possess particular DOF). +To describe physical meaning of particular Dof, special enum type `DofId` has +been introduced (see src/oofemlib/cltypes.h). This type is more descriptive than +UnknownType, which determines physical meaning for unknowns generally +(displacement or temperature). `DofId` type has to distinguish between +DOFs representing displacement, but in different directions, since +only some of those may be required by particular elements. + +DOF can be subjected to boundary (BC) or initial (IC) condition. Method for +obtaining DOF unknown value is provided. If no IC condition +has been given, zero value IC is assumed otherwise when needed. + +`Dof` class generally supports changes of static system during computation. +This feature generally leads to equation renumbering. Then because equation number +associated to dof may change, it may become extremely complicated to ask EngngModel +for unknown from previous time step (because equation number may have been changed). +To overcome this problem, derived class will implement so called unknown dictionary, +which is updated after finishing each time step and where unknowns for particular +dof are stored. Dof then uses this dictionary for requests for unknowns instead of +asking EngngModel instance for unknowns. Unknowns in dof dictionary are updated by EngngModel +automatically (if EngngModel supports changes of static system) after finishing time +step. + +The base class `Dof` declares many services necessary for DOF +handling. Some of them are abstract, they have to be implemented by +derived classes representing specific DOF types. +This basic DOF interface includes the following services + +- Services for requesting corresponding unknowns (`giveUnknown`) + and the prescribed boundary values (`giveBcValue`). +- Methods for requesting associated equation number + (`giveEquationNumber`). +- Services for requesting DOF properties (`hasBc`, + `hasIc`, `giveDofID`, `giveDofIDName`, + `giveUnknownType`, `isPrimaryDof`). +- Services for dof output (`printOutputAt`, `printStaticOutputAt`, + `printDynamicOutputAt`), +- updating the receiver after new equilibrium is reached + (`updateYourself`, `updateUnknownsDictionary`), +- services for storing/restoring context (`saveContext`, `restoreContext`). + + +The derived classes implement specific types of DOFs. The +most common types are provided with OOFEMlim. Supported are so-called +MasterDofs, representing true DOFs with their own equation number, +SlaveDOFs, representing single DOF linked to another single DOF, Rigid Arm DOFs +allowing to model rigid arms (single dof linked to one or more other DOFs). +Their brief description follows: + +- `MasterDof` - class representing "master" degree of freedom. + Master is degree of freedom, which has its related unknown and + corresponding equation number. It maintain its equation number. +- `SlaveDof` - class representing "slave" degree of freedom. + SlaveDOF is linked to some master dof (link slave-slave is not + allowed). Slaves can be used to implement duplicated joints (by + specifying some DOF in node as masters and some as slaves linked to + DOFs in other node (with same or possibly different + coordinates). SlaveDOF share the same equation number with + master. Almost all operation as request for BC or IC or equation + number are simply forwarded to master. Other functions (which change + internal state) like updateYourself, updateUnknownsDictionary, + askNewEquationNumber or context storing/restoring functions are empty + functions, relying on fact that same function will be called also for + master. From this point of view, one can see slave dof as link to + other dof. +- `RigidArmSlaveDof` - class representing "rigid arm slave" degree + of freedom. This DOF is linked to some master DOFs by linear + combination (link slave-slave is + not allowed) using rigid arm. Implemented using nodal + transformation. The Rigid Arm Slave dof represent DOF, which is + directly related to one or more master DOFs. Therefore the rigid arm slave's + equation number is undefined. Similarly, rigid arm slave cannot have + own boundary or initial conditions - these are entirely determined + using master boundary or initial conditions. + The transformation for DOFs and load is not orthogonal - the inverse + transformation can not be constructed by transposition. Because of + time consuming inversion, methods can generally compute both + transformations for DOFs as well as load components. It is important to ensure + (on input) that both slave dofManager and master dofManager are using + the same local coordinate system. In future releases, this can be + checked using checkConsistency function, where this check could be + performed. + +Dof Managers +------------------- +The `DofManager` class is the base class for all DOF +managers. `DofManager` is an abstraction for object possessing degrees +of freedom (DOFs). Dof managers (respectively derived classes, +representing nodes or sides) are usually shared by several elements +and are maintained by corresponding domain. The elements keep the +logical reference to corresponding dof managers (they store their +numbers, not the physical links). +The base class declares the variable storing total number of DOFs, +the `dofArray`array representing the list of DOFs managed by dof +manager, and `loadArray` list for storing the applied +loadings references. +The `DofManager` declares (and implements some of them) +following services: + +- DOF management methods. The methods for requesting the total number of + DOFs (`giveNumberOfDofs`), requesting particular DOFs + (`giveDof`), assembling location array of code numbers + (`giveLocationArray` and `giveCompleteLocationArray`), +- methods for DOF selection based on their physical meaning + (`giveDofArray` and `findDofWithDofId`), and services + for requesting unknowns related to dof manager DOFs + (`giveUnknownVector` and `givePrescribedUnknownVector`). +- Transformation functions. + The governing equations can be assembled not only in global coordinate system, but + also in user-defined local coordinate system of each dof + manager. Following methods introduce necessary transformation methods, + allowing DOFs to be expressed in their own local c.s. or to be + dependent on other DOFs on other dofManager (to implement + slave or rigid arm nodes etc.). + The methods for computing transformation matrices from global c.s to + receiver's defined coordinate system are declared + (`computeDofTransformation` and `computeLoadTransformation`). + The `requiresTransformation` indicates whether dofManager requires the transformation from global c.s. to + dof manager specific coordinate system. +- Load/boundary condition management functions. The two methods are provided for handling + applied loading - the service for computing the load vector of + receiver in given time (`computeLoadVectorAt`) and service + providing the list of applied loads (`giveLoadArray`). +- Context related services for storing/restoring the receiver state to + context (`saveContext` and `restoreContext` services) + are implemented. +- Instantiating service `initializeFrom`. +- Miscellaneous services for receiver printing, identification, etc. + +In the OOFEMlib the common specialized dof managers are +defined and implemented. Those currently provided are: + +- `Node` class. Class implementing node in finite element mesh. + Node manages its position in space, and if specified, its + local coordinate system in node. If local coordinate system is defined, all + equilibrium equations are assembled in this system and therefore all DOFs and + applied boundary and initial conditions apply in this local coordinate system. + By default, global coordinate system is assumed in each node. +- `RigidArmNode` class. + Class implementing node connected to other node (master) using rigid arm in finite element mesh. + Rigid arm node supports not only slave DOFs mapped to master + but also some DOFs can be primary DOFs. The `masterDofMask` + attribute is introduced allowing to + distinguish between primary and mapped (slave) DOFs. + The primary DOFs can have their own boundary and initial conditions. + The introduction of rigid arm connected nodes allows to avoid very stiff elements used + for modelling the rigid-arm connection. The rigid arm node maps its DOFs to master DOFs + using simple transformations (small rotations are assumed). Therefore, the contribution + to rigid arm node are localized directly to master related equations. + The rigid arm node slave (mapped DOFs can not have its own boundary or initial conditions, + they are determined completely from master dof conditions. + The local coordinate system in slave is not supported in current implementation, the global lcs applies. + On the other hand, rigid arm node can be loaded independently of master. + The transformation for DOFs and load is not orthogonal - the inverse transformation can + not be constructed by transposition. Because of time consuming inversion, methods + can generally compute both transformations for DOFs as well as loads. +- `ElementSide` class - representing finite element side possessing some DOFs. + + +Boundary Conditions +------------------- +The library introduces the base abstract class `GeneralBoundaryCondition` for all boundary +conditions (both primary and secondary). +Boundary condition is an attribute of the domain (it belongs to). +The other system components subjected to boundary conditions keep reference to corresponding boundary +conditions, like elements, nodes, and DOFs. + +The base class only declares itself as a base class of all boundary +conditions, and declares only very basic services. It introduces +'loadTimeFunction' as an attribute of each boundary condition. +'loadTimeFunction' represent time variation, its value is dependent on time step. +The value (or the components) of a boundary condition (load) will be +the product of its value by the value of the associated load time function at given time step. +The meaning of boundary condition components is dependent on particular boundary condition type, +and should be defined in derived classes documentation. This base +class introduces also two general services for requesting boundary +condition physical meaning and boundary condition geometrical +character (point-wise, acting on element body or edge and so on). + +Derived classes should represent the base classes for particular boundary condition type (like +force load, or boundary condition prescribed directly on some DOF) and should declare +the basic common interface. For example, the `Load` is derived +from `GeneralBoundaryCondition` and represent base class for all +boundary conditions representing load. The following derived classes are provided by OOFEMlib + +- `Load` class - base abstract class for all loads. Declares the + attribute `componentArray` to store load components and + method for evaluating the component values array at given time (component array multiplied + with load time function value) is provided. +- `NodalLoad` - implementation of a concentrated load/flux (force, + moment,...) that acts directly on a dof manager (node or element + side, if it has associated DOFs). + This load could not be applied on an element. A nodal load is usually attribute of + one or more nodes or element sides. +- `BoundaryLoad` - abstract base class representing a boundary + load (force, momentum, ...) that acts directly on a boundary of some + finite element (on element side, face, ...). Boundary load is usually + attribute of one or more finite elements. This base class only + declares the common services to all derived classes. Derived + classes must implement abstract services and possibly may customize + existing. Boundary load is represented by its geometry (determined by + its type - linear, quadratic load) and values (it is assumed, that + user will supply all necessary values for each dof). + The load can generally be specified in global space or can be related + to local entity space (related to edge, surface). If load is specified + in global space then its values are evaluated at points, which is + characterized by global coordinates. If load is specified in entity + space, then point is characterized by entity isoparametric + coordinates. +- `BodyLoad` - Class representing base class for all element body load, acting over + whole element volume (e.g., the dead weight). +- `BoundaryCondition` - class representing Dirichlet boundary condition (primary boundary condition). + This boundary condition is usually attribute of one or more degrees of + freedom (DOF). The type of unknown (physical meaning) is fully + determined by corresponding DOF, to which given BC is associated. + Boundary condition can change its value in time using its inherited + `loadTimeFunction` attribute. + It can also switch itself on or off depending on nonzero value of introduced + isImposedTimeFunction load time function. Please note, that previous option must be + supported by particular engineering model (because equation renumbering is necessary, + and for incremental solution schemes DOFs unknown dictionaries must be used). See particular + engineering model documentation for details. + +Initial Conditions +------------------- +The `InitialCondition` - class implementing general initial condition. Initial condition is usually attribute of +one or more degrees of freedom (DOFs). One particular DOF (with its +physical meaning - for example displacement) can have associated only +single initial condition. Initial condition thus must represent +several initial conditions for particular DOF (for example velocity +and acceleration of unknown can be prescribed using single initial +condition instance). These multiple entries are distinguished by their +`CharTypeMode`` value. The CharTypeMode value is also used as key in +`initialValueDictionary`. +Initial conditions apply and should be taken into account only in one +particular time step, which number is determined from engineering +model `giveNumberOfTimeStepWhenIcApply`` service. If in this +time step both boundary condition on unknown and also initial +condition on value of this unknown (TotalMode CharTypeMode) are +prescribed, then always value reported by boundary condition is taken +into account. diff --git a/doc/developerGuide/element_frame.rst b/doc/developerGuide/element_frame.rst new file mode 100644 index 000000000..41039522d --- /dev/null +++ b/doc/developerGuide/element_frame.rst @@ -0,0 +1,727 @@ + +Elements +====================== + +In this frame, the following base classes are introduced: + +- Class `Element`, which is an abstraction of a finite element. It declares + common general services, provided by all elements. Derived + classes are the base classes for specific analysis types (structural + analysis, thermal analysis). They declare and implement necessary services for + specific analysis. +- Class `IntegrationPoint` is an abstraction for + the integration + point of the finite element. For historical reasons the `IntegrationPoint` is an alias to `GaussPoint` class. It maintains its coordinates and integration + weight. Any integration point can generally contain any number of + other integration points - called slaves. The `IntegrationPoint` instance containing slaves is called master. Slaves are, for example, + introduced by a layered cross section model, where they represent + integration points for each layer, or can be introduced at material + model level, where they may represent, for example, micro-planes. Slave + integration points are hidden from elements. The `IntegrationPoint` + contains associated material status to store state variables (the reasons for introducing + this feature will be explained later). +- `CrossSection` class is an abstraction for cross section. Its + main role is to hide from an element all details concerning the cross + section description and implementation. By cross section description + is meant, for example, an integral cross section model, layered cross + section model or fibered model. Elements do not communicate directly + with material, instead they always use a `CrossSection`, which + performs all necessary integration over its volume and invokes + necessary material class services. Note, that for some problems, the use + of cross section is not necessary, and then + the elements can communicate directly with material model. However, for + some problems (for example structural analysis) the introduction of cross section + is natural. +- `Material` class is the base class for all + constitutive models. Derived classes should be the base + analysis-specific classes, which declare required analysis + specific services (for example structural material class declares + services for the stiffness computation and services for the real stress + evaluation). Similarly to cross section representation, the material model analysis specific interface, defined + in terms of general services, allows the use of any material model, even + that added in the future, without modifying any code, because all material + models implement the same interface. + +One of the most important goals of OOFEM is its +extensibility. In the case of extension of the material library, the +analyst is facing a key problem. Every material model must store +its unique state variables in every integration point. The +amount, type, and meaning of these history variables vary for each +material model. Therefore, it is not possible to efficiently +match all needs and to reflect them in the integration point data +structure. The suggested remedy is the following: + +The `IntegrationPoint` class is equipped with the possibility to have +associated a `MaterialStatus` class instance. When a new material model is +implemented, the analyst has also to declare and implement a related +material status derived from the base +`MaterialStatus` class. This status contains all necessary +state variables and related data access and modification +services. The `IntegrationPoint` provides services for inserting and +accessing its related status. For every `IntegrationPoint`, +the corresponding material creates unique copy of its material +status and associates it with that integration point. Because +the `IntegrationPoint` is a compulsory parameter of all `Material` class methods, the state variables are always accessible. + +:: TODO Add a figure of the element-material frame. + +.. + @startuml + together { + abstract class CrossSection + abstract class Element + abstract class IntegrationRule + } + + abstract class Material + abstract class MaterialStatus + + + class ISOLEMaterial + class ISOLEMaterialStatus + class IntegrationPoint + + IntegrationRule "1" o-- "1,n" IntegrationPoint + + Material "1,n" -- "1" CrossSection + Material <|-- ISOLEMaterial + ISOLEMaterial --- ISOLEMaterialStatus: Defines > + MaterialStatus <|-- ISOLEMaterialStatus + CrossSection - Element + Element -o IntegrationRule + + IntegrationPoint "1" - "1" ISOLEMaterialStatus + + @enduml + + +.. figure:: figs/elementmaterialframe.png + :alt: OOFEM structure of Element-Material frame + :name: fig-elementmaterialframe + :width: 70.0% + +OOFEM Top level structure + +In Fig (fig-elementmaterialframe_), the material - element frame is +depicted in more detail, although still simplified. + +`Element` class +--------------- +This class is the base class for all FE elements. It is also the +abstract class, declaring some services, which have to be implemented +by the derived classes. The main purpose of this class is to define a common interface and attributes, provided by all individual element implementations. +The `Element`` class does neither declare nor +implement any method related to specific analysis. These services are to be declared +and possibly implemented by derived classes. +The direct child of `Element` class are assumed to be the base +classes for particular analysis or problem type. They typically +introduce the general services required for a specific analysis purpose +- like evaluation of stiffness or mass matrices for structural +analysis, or evaluation of capacity and conductivity matrices for heat +transfer analysis. Usually they also provide generic implementation of +these services. + +The `Element` class is derived from parent `FEMComponent`, leke many other classes. It inherits +the `FEMComponent` ability to keep its number and reference +to the domain, it belongs to, its error and warning +reporting services. +Also the `FEMComponent` class introduces several abstract services. The most +important are + +- `initializeFrom` for object initialization from a given record, +- `saveContext` and `restoreContext` methods for storing and restoring object state to/from a stream + +The attributes defined by the `Element` class include the +arrays used to keep its list of nodes and sides, variables to store its material +and cross section number, lists of applied body and boundary loads, +list of integration rules and array storing its code numbers. + + +The following important services are declared/introduced by the `Element`: + +- services for component management - include services for + accesing element's nodes, material and cross section (`giveDofManager`, `giveNode`, + `giveNumberOfDofManagers`, `giveNumberOfNodes`, `giveMaterial`, `giveCrossSection`). +- services related to code numbers management: + + - `giveLocationArray` returns the element location array. This + location array is obtained by appending code-numbers of element + nodes (according to the node numbering), followed by code numbers of + element sides. The ordering of DOFs for the particular node/side is + specified using a node/side DOF mask, which is obtained/defined by + `giveNodeDofIDMask` or `giveSideDofIDMask` services. + Please note, that this local DOF ordering must be taken into account when assembling various local characteristic + vectors and matrices. Once the element location array is assembled, + it is cached and reused to avoid time consuming assembly. + Some engineering models + may support dynamic changes of the static system (generally, of boundary conditions) during analysis, + then these models use `invalidateLocationArray` function to invalidate location array + after finishing time step, to force new equation numbering. + - `computeNumberOfDofs` - computes or simply returns total + number of element's local DOFs. Must be implemented by particular + element. + - `giveDofManDofIDMask` service return + DOF mask for corresponding dof manager (node or side). This mask defines the DOFs which are used by element + at the given node/side. The mask influences the code number ordering + for the particular node. Code numbers are + ordered according to the node order and DOFs belonging to the particular node are ordered + according to this mask. If element requests DOFs using a node mask + which are not in the node + then error is generated. This masking allows node to be shared by different elements with + different DOFs in the same node/side. Element's local code numbers are + extracted from the node/side using + this mask. These services must be implemented (overloaded) by + particular element implementations. +- services for requesting the so-called characteristic + components: `giveCharacteristicMatrix` and `giveCharacteristicVector`. + The component requested is identified by parameter of type + `CharType` (see cltypes.h). These are general methods for obtaining various element + contributions to the global problem. These member functions have to + be overloaded by derived analysis-specific + classes in order to invoke the proper method according to the type of + requested component. +- services related to the solution step update and termination. + These services are used to update the internal variables at + element's integration points prior to reached state + `updateYourself` and `updateInternalState`. + Similar service for the internal state initialization is also declared + (`initializeYourself`) and re-initialization to previous + equilibrium state (see `initForNewStep`). +- services for accessing local element's unknowns from corresponding DOFs. + These include methods for requesting local element vector of unknowns + (`computeVectorOf`) and local element vector of prescribed + unknowns (`computeVectorOfPrescribed`). +- Services for handling transformations between element local coordinate + system and coordinate system used in nodes (possibly different from + global coordinate system). +- Othetr miscellaneous services. Their detailed description can be found in `Element` class definition in `sr/oofemlib/element.h`. + + +Analysis specific element classes +--------------------------------- +The direct child classes of the `Element` class are supposed to be (but not need to be) base +classes for particular problem types. For example, the +`StructuralElement` class is the base class for all structural +elements. It declares all necessary services required by structural +analysis (for example methods computing stiffness matrices, load, +strain and stress vectors etc.). This class may provide general +implementations of some of these services if possible, implemented +using some low-level virtual functions (like computing element shape functions), which are declared, but +their implementation is left on derived classes, which implement specific +elements. + +Structural element +------------------ + +To proceed, lets take `StructuralElement` class as an example. This class is derived from the `Element` class. +The basic tasks of the structural element is to compute its contributions +to global equilibrium equations (mass and stiffness matrices, various +load vectors (due to boundary conditions, force loading, thermal +loading, etc.) and computing the corresponding strains and stresses +from nodal displacements. Therefore the corresponding virtual services +for computing these contributions are declared. +These standard contributions can be computed by numerical +integration of appropriate terms, which typically depend on +element interpolation or material model, over the element volume. Therefore, it is possible to +provide general implementations of these services, provided that the +corresponding methods for computing interpolation dependent terms and +material terms are implemented, and corresponding integration rules +are initialized. + +This concept will be demonstrated on service computing stiffness +matrix. Since element stiffness matrix contributes to the global +equilibrium, the stiffness will be requested (by engineering model) using +`giveCharacteristicMatrix` service. + + +.. code-block:: cpp + :linenos: + + void + StructuralElement :: giveCharacteristicMatrix (FloatMatrix& answer, + CharType mtrx, TimeStep *tStep) + // + // returns characteristic matrix of receiver according to mtrx + // + { + if (mtrx == TangentStiffnessMatrix) + this -> computeStiffnessMatrix(answer, TangentStiffness, tStep); + else if (mtrx == SecantStiffnessMatrix) + this -> computeStiffnessMatrix(answer, SecantStiffness, tStep); + else if (mtrx == MassMatrix) + this -> computeMassMatrix(answer, tStep); + else if + .... + } + +The first parameter is the matrix to be computed, the mtrx +parameter determines the type of contribution and the last parameter, time step, represents solution step. +Focusing only on material nonlinearity, the element stiffness matrix can be evaluated using well-known formula + +.. math:: + {K} = \int_{V} {B}^T{D}{B}\;dV, + +where B is the so-called geometrical matrix, containing +derivatives of shape functions and D is the material stiffness +matrix. If D is symmetric (which is usually the case) then +element stiffness is symmetric, too. The numerical integration is used to evaluate the integral. +For numerical integration, we will use `IntegrationRule` class instance. +The integration rules for a specific element are created during element +initialization and are stored in `integrationRulesArray` attribute, +defined/introduced by the parent `Element` class. In order to implement the stiffness +evaluation, the methods for computing geometrical matrix B and material stiffness +matrix D are declared (as virtual), but not implemented. They have to +be implemented by specific elements, because they know their interpolation +and material mode details. +The implementation of `computeStiffnessMatrix`` is as follows: + + +.. code-block:: cpp + :linenos: + + void + StructuralElement :: computeStiffnessMatrix (FloatMatrix& answer, + MatResponseMode rMode, TimeStep* tStep) + // Computes numerically the stiffness matrix of the receiver. + { + int j; + double dV ; + FloatMatrix d, bj, dbj; + GaussPoint *gp ; + IntegrationRule* iRule; + + // give reference to integration rule + iRule = integrationRulesArray[giveDefaultIntegrationRule()]; + + // loop over integration points + for (j=0 ; j < iRule->getNumberOfIntegrationPoints() ; j++) { + gp = iRule->getIntegrationPoint(j) ; + // compute geometrical matrix of particular element + this -> computeBmatrixAt(gp, bj) ; + //compute material stiffness + this -> computeConstitutiveMatrixAt(d, rMode, gp, tStep); + // compute jacobian + dV = this -> computeVolumeAround(gp) ; + // evaluate stiffness + dbj.beProductOf (d, bj) ; + answer.plusProductSymmUpper(bj,dbj,dV) ; + } + answer.symmetrized() ; + return ; + } + + +Inside the integration loop, only the upper half of the element stiffness is +computed in element local coordinate system. Then, the lower part of +the stiffness is initialized from the upper part (answer.symmetrized()). +The other element contributions can be computed using similar +procedures. In general, different integration rules can be used for +evaluation of different element contributions. For example, the +support for the reduced +integration of some terms of the stiffness matrix can be easily supported. + +The element strain and stress vectors are to be +computed using `computeStrainVector` and +`computeStressVector` services. The element strain vector can +be evaluated using + +.. math:: + \varepsilon={B}{u}, + +where B is the geometrical matrix and u is element local displacement +vector. + +.. code-block:: cpp + :linenos: + + void + StructuralElement :: computeStrainVector (FloatArray& answer, + GaussPoint* gp, TimeStep* stepN) + // Computes the vector containing the strains + // at the Gauss point gp of the receiver, + // at time step stepN. The nature of these strains depends + // on the element's type. + { + FloatMatrix b; + FloatArray u ; + + this -> computeBmatrixAt(gp, b) ; + // compute vector of element's unknowns + this -> computeVectorOf(DisplacementVector, + UnknownMode_Total,stepN,u) ; + // transform global unknowns into element local c.s. + if (this->updateRotationMatrix()) + u.rotatedWith(this->rotationMatrix,'n') ; + answer.beProductOf (b, u) ; + return ; + } + + +The stress evaluation on the element level is rather simple, since the stress +evaluation from a given strain increment and actual state (kept within +the integration point) is done at the cross section and material model levels: + +.. code-block:: cpp + :linenos: + + void + StructuralElement :: computeStressVector (FloatArray& answer, + GaussPoint* gp, TimeStep* stepN) + // Computes the vector containing the stresses + // at the Gauss point gp of the receiver, at time step stepN. + // The nature of these stresses depends on the element's type. + { + FloatArray Epsilon ; + StructuralCrossSection* cs = (StructuralCrossSection*) + this->giveCrossSection(); + Material *mat = this->giveMaterial(); + + this->computeStrainVector (Epsilon, gp,stepN) ; + // ask cross section model for real stresses + // for given strain increment + cs -> giveRealStresses (answer, ReducedForm, gp, Epsilon, stepN); + return ; + } + + +For further reference see src/sm/Elements/structuralelement.h +and src/sm/Elements/structuralelement.C files located in your source oofem directory. + +Example: 2D Truss element +-------------------------- +In this section, we provide a simple, but complete example of a two-dimensional truss element implementation. +The element is derived from the `StructuralElement` class and is called `Truss2d`: + +.. + @startuml + Abstract class Element + Abstract class StructuralElement + class Truss2d + + Element <|- StructuralElement + StructuralElement <|- Truss2d + + @enduml + +.. figure:: figs/truss2dclass.png + :alt: OOFEM structure of Element-Material frame + :name: fig-truss2dclass + :width: 70.0% + +The definition of the `Truss2d` class is as follows (see also sm/src/Elements/Bars/Truss2d.h): + +.. code-block:: cpp + :linenos: + + class Truss2d : public StructuralElement { + protected : + double length ; + double pitch ; + public : + Truss2d (int,Domain*) ; // constructor + ~Truss2d () {} // empty destructor + // mass matrix coputations + void computeLumpedMassMatrix (FloatMatrix& answer, + TimeStep* tStep) override; + // general mass service overloaded + void computeMassMatrix (FloatMatrix& answer, TimeStep* tStep) override + {computeLumpedMassMatrix(answer, tStep);} + // DOF management + virtual int computeNumberOfDofs (EquationID ut) override {return 4;} + virtual void giveDofManDofIDMask (int inode, EquationID, IntArray& ) const override; + + double computeVolumeAround (GaussPoint*) override; + // definition & identification + char* giveClassName (char* s) const override + { return strcpy(s,"Truss2d") ;} + classType giveClassID () const override { return Truss2dClass; } + + IRResultType initializeFrom (InputRecord* ir) override; + protected: + // computes geometrical matrix + void computeBmatrixAt (GaussPoint*, FloatMatrix&, + int=1, int=ALL_STRAINS) override; + // computes interpolation matrix + void computeNmatrixAt (GaussPoint*, FloatMatrix&) override; + // initialize element's integration rules + void computeGaussPoints () override; + // transformation from global->local c.s. + int computeGtoLRotationMatrix (FloatMatrix&) override; + + double giveLength () ; + double givePitch () ; + } ; + + +The `Truss2d` class declares two attributes, the element `length`` and element `pitch`, defined as angle between global x-axis and element x-axis. They can be computed from coordinates of element nodes, but they are used at different places of implementation and precomputing then can save some proccesing time. +We define the constructor and destructor of the `Truss2d` class. Next we define methods to compute characteristic contributions of the element. +Note that default implementation of characteristic matrix evaluation (stiffness nad mass matrix) is already provided by parent `StructuralElement` class. +We just need to implement the methods for computing geometrical and interpolation matrices. +However in this case, the mass matrix is going to be computed using the lumped mass matrix method, and we need to overload the default implementation. + +We also need to implement the methods for computing the number of element DOFs (`computeNumberOfDofs`), method to return element DOFs for specific node (`giveDofManDofIDMask`). +Also, the method to evaluate the volume associated to given integration point (`computeVolumeAround`), method to initialize element from input record (`initializeFrom`). +Finally, in the protected section, there is a declaration of methods for computing the geometrical ( `computeBmatrixAt`) and interpolation matrices (`computeNmatrixAt`), +as well as the method to initialize the element's integration rules (`computeGaussPoints`) and method to compute the element transformation matrix (`computeGtoLRotationMatrix`). +Note than all these methods overload/specialize/define methods declared in the parent `StructuralElement` or `Element` classes. +Finally, we declare two methods to compute the element length and pitch. + + +The implementation of the `Truss2d` class is as follows (see also sm/src/Elements/Bars/Truss2d.C, but note this implementation supports geometrical nonlinearity and is more general), wih some minor methods ommited for brevity: +We start with the services for computing interpolation and geometrical matrices. +Note that the implementation of the \service{computeNmatrixAt} is not necessary +for the current purpose (it would be required by the default mass matrix computation), but it is added for completeness. +The both methods compute response at a given integration point, which is +passed as a parameter. The \service{computeBmatrixAt} has two additional +parameters which determine the range of strain components for which +response is assembled. This has something to do with support for +reduced/selective integration and is not important in presented case. + +The ordering of element unknowns is following: :math:`r_e=\{u1,y1, u2,y2\}^T`, where u1,u2 are displacements in x-direction and y1,y2 are displacements in y-direction and indices indicate element nodes. +This ordering is defined by element node numbering and element nodal unknowns (determined by `giveDofManDofIDMask` method). The vector of unknowns (and also element code numbers) is appended from nodal contributions. +The element uses linear interpolation functions, so the element shape functions are linear functions of the local coordinate. The element has 2 nodes, so the element has 4 DOFs. +The interpolation functions are defined as follows: + +.. math:: + N_1 = \frac{1-\xi}{2}, \quad N_2 = \frac{1+\xi}{2}, + +and their derivatives: + +.. math:: + \frac{\partial N_1}{\partial \xi} = -\frac{1}{2}, \quad \frac{\partial N_2}{\partial \xi} = \frac{1}{2}. + +So that the interpolation and geometrical matrices are defined as follows: + +.. math:: + \{u,v\}^T = N^e r_e, \ \{\varepsilon\} = B^e r_e^l\\[4mm] + B^e = \begin{bmatrix} -\frac{1}{L} & 0 & \frac{1}{L} & 0 \end{bmatrix},\\ + \quad N^e = \begin{bmatrix} N_1 & 0 & N_2 & 0 \\ 0 & N_1 & 0 & N_2 \end{bmatrix}, + +The transformation matrix from unknowns in global coordinate system to element local coordinate system is defined as follows: + +.. math:: + \cos\theta = (x_2-x_1)/l,\ \sin\theta = (y_2-y_1)/l,\\[4mm] + \begin{bmatrix} u_1 \\ v_1 \\ u_2 \\ v_2 \end{bmatrix}^l = \begin{bmatrix} \cos \theta & \sin \theta & 0 & 0 \\ -\sin \theta & \cos \theta & 0 & 0 \\ 0 & 0 & \cos \theta & \sin \theta \\ 0 & 0 & -\sin \theta & \cos \theta \end{bmatrix} \begin{bmatrix} u_1 \\ v_1 \\ u_2 \\ v_2 \end{bmatrix}^g, + +where :math:`\theta` is the pitch of the element. + + + +.. note:: Recently, the interpolation classes have been added, that can significantly facilitate the element implementation. They provide shape functions, their derivatives, and transformation Jacobian out of the box. + +.. + +.. code-block:: cpp + :linenos: + + void + Truss2d :: giveDofManDofIDMask (int inode, EquationID, IntArray& answer) const { + // returns DofId mask array for inode element node. + // DofId mask array determines the dof ordering requested from node. + // DofId mask array contains the DofID constants (defined in cltypes.h) + // describing physical meaning of particular DOFs. + //IntArray* answer = new IntArray (2); + answer.resize (2); + + answer.at(1) = D_u; + answer.at(2) = D_w; + + return ; + } + + void + Truss2d :: computeNmatrixAt (GaussPoint* aGaussPoint, + FloatMatrix& answer) + // Returns the displacement interpolation matrix {N} + // of the receiver, evaluated at aGaussPoint. + { + double ksi,n1,n2 ; + + ksi = aGaussPoint -> giveCoordinate(1) ; + n1 = (1. - ksi) * 0.5 ; + n2 = (1. + ksi) * 0.5 ; + + answer.resize (2,4); + answer.zero(); + + answer.at(1,1) = n1 ; + answer.at(1,3) = n2 ; + answer.at(2,2) = n1 ; + answer.at(2,4) = n2 ; + + return ; + } + + + void + Truss2d :: computeBmatrixAt (GaussPoint* aGaussPoint, + FloatMatrix& answer, int li, int ui) + // + // Returns linear part of geometrical + // equations of the receiver at gp. + // Returns the linear part of the B matrix + // + { + double coeff,l; + + answer.resize(1,4); + l = this->giveLength(); + coeff = 1.0/l; + + answer.at(1,1) =-coeff; + answer.at(1,2) = 0.0; + answer.at(1,3) = coeff; + answer.at(1,4) = 0.0; + + return; + +Next, the following two functions compute the basic geometric +characteristics of a bar element - its length and pitch, defined as the +angle between global x-axis and the local element x-axis (oriented +from node1 to node2). + +.. code-block:: cpp + :linenos: + + double Truss2d :: giveLength () + // Returns the length of the receiver. + { + double dx,dz ; + Node *nodeA,*nodeB ; + + if (length == 0.) { + nodeA = this->giveNode(1) ; + nodeB = this->giveNode(2) ; + dx = nodeB->giveCoordinate(1)-nodeA->giveCoordinate(1); + dz = nodeB->giveCoordinate(3)-nodeA->giveCoordinate(3); + length= sqrt(dx*dx + dz*dz) ;} + + return length ; + } + + + double Truss2d :: givePitch () + // Returns the pitch of the receiver. + { + double xA,xB,zA,zB ; + Node *nodeA,*nodeB ; + + if (pitch == 10.) { // 10. : dummy initialization value + nodeA = this -> giveNode(1) ; + nodeB = this -> giveNode(2) ; + xA = nodeA->giveCoordinate(1) ; + xB = nodeB->giveCoordinate(1) ; + zA = nodeA->giveCoordinate(3) ; + zB = nodeB->giveCoordinate(3) ; + pitch = atan2(zB-zA,xB-xA) ;} + + return pitch ; + } + + +When an element is created, the default +constructor is called. To initialize the element, according to its +record in the input file, the `initializeFrom` is +immediately called after element creation. The element implementation +should first call the parent implementation to ensure that attributes +declared at parent level are initialized properly. +Then the element has to +initialize attributes declared by itself and also to set up its +integration rules. In our example, special method +`computeGaussPoints` is called to +initialize integration rules. +in this case, only one integration rule is created. It is of type +`GaussIntegrationRule`, indicating that the Gaussian integration +is used. Once integration rule is created, its integration points are +created to represent line integral, with 1 integration +point. Integration points will be associated to element under +consideration and will have 1D material mode (which determines the type of +material model response): + +.. code-block:: cpp + :linenos: + + IRResultType + Truss2d :: initializeFrom (InputRecord* ir) + { + this->NLStructuralElement :: initializeFrom (ir); + this -> computeGaussPoints(); + return IRRT_OK; + } + + void Truss2d :: computeGaussPoints () + // Sets up the array of Gauss Points of the receiver. + { + + numberOfIntegrationRules = 1 ; + integrationRulesArray = new IntegrationRule*; + integrationRulesArray[0] = new GaussIntegrationRule (1,domain, 1, 2); + integrationRulesArray[0]-> + setUpIntegrationPoints (_Line, 1, this, _1dMat); + + } + +Next, we present method calculating lumped mass matrix: + +.. code-block:: cpp + :linenos: + + void + Truss2d :: computeLumpedMassMatrix (FloatMatrix& answer, TimeStep* tStep) + // Returns the lumped mass matrix of the receiver. This expression is + // valid in both local and global axes. + { + Material* mat ; + double halfMass ; + + mat = this -> giveMaterial() ; + halfMass = mat->give('d') * + this->giveCrossSection()->give('A') * + this->giveLength() / 2.; + + answer.resize (4,4) ; answer.zero(); + answer . at(1,1) = halfMass ; + answer . at(2,2) = halfMass ; + answer . at(3,3) = halfMass ; + answer . at(4,4) = halfMass ; + + if (this->updateRotationMatrix()) + answer.rotatedWith(*this->rotationMatrix) ; + return ; + } + +Finally, the following method computes the part of the element transformation +matrix, corresponding to transformation between global and element +local coordinate systems. This method is called from +the `updateRotationMatrix` service, implemented at +the `StructuralElement` level, which computes the element +transformation matrix, taking into account further transformations +(nodal coordinate system, for example). + +.. code-block:: cpp + :linenos: + + int + Truss2d :: computeGtoLRotationMatrix (FloatMatrix& rotationMatrix) + // computes the rotation matrix of the receiver. + // r(local) = T * r(global) + { + double sine,cosine ; + + sine = sin (this->givePitch()) ; + cosine = cos (pitch) ; + + rotationMatrix.resize(4,4); + rotationMatrix . at(1,1) = cosine ; + rotationMatrix . at(1,2) = sine ; + rotationMatrix . at(2,1) = -sine ; + rotationMatrix . at(2,2) = cosine ; + rotationMatrix . at(3,3) = cosine ; + rotationMatrix . at(3,4) = sine ; + rotationMatrix . at(4,3) = -sine ; + rotationMatrix . at(4,4) = cosine ; + + return 1 ; + } + + diff --git a/doc/developerGuide/engng_frame.rst b/doc/developerGuide/engng_frame.rst new file mode 100644 index 000000000..c8abf7c81 --- /dev/null +++ b/doc/developerGuide/engng_frame.rst @@ -0,0 +1,506 @@ + +Problem representation - Engineering model +========================================== + +In this section, we introduce in detail how the problems are represented, their discrete form assembled and finally solved. + +We start with `EngngModel` class, which is an abstraction for the problem under +consideration. It represents the analysis to be performed. +Base class declares and implements the basic general services for assembling +characteristic components and services for starting the solution step and +its termination. Derived classes know the form of governing +equation and the physical meaning of particular components. +They are responsible for forming the governing equation for each solution +step, usually by summing contributions from particular elements and +nodes, and their solution using the suitable numerical method. + +.. + @startuml + together { + abstract class "EngngModel" + abstract class "NumericalMethod" + abstract class "SparseMtrx" + } + + together{ + class Domain + class LinearStatics + class SparseLinearSolver + } + class Skyline + + EngngModel o-- Domain + EngngModel ^-- LinearStatics + NumericalMethod ^-- SparseLinearSolver + SparseMtrx ^-- Skyline + LinearStatics - SparseLinearSolver + SparseLinearSolver - Skyline + @enduml + +.. + //www.plantuml.com/plantuml/png/ROw_ZeCm3CPtFqN4pZimt6t7BUoLt63Hg4vIEQPgXNZtefAMKXZzy_VdgvAYQEyPD7Qa9n8p01wJ2berbZ4bOuhVq8MkZYrniNt-zvx4MUHwyiTsHz5SK1BLAhS2HdWt3J0BVg975_BnvmAXD8hgRCfizkTFv2i9ZA_N-SuJ1rWccbYMEVEJ7YQw3lyQ_bJiL2thPqLkN6MPNUSMcSKF5OMsz_m0 + +.. figure:: figs/engngmframe.png + :alt: OOFEM structure of Element-Material frame + :name: fig-elementmaterialframe + :width: 70.0% + +The solution step may represent either a time step, a load increment, or a load +case. The solution steps are grouped together into so called meta steps. +The meta step can be thought as a sequence of +solution steps, with the same set of attributes used to drive the behavior of +EngngModel. +For each meta step, the `EngngModel` typically updates +its control parameters according to ones defined by meta step (see +updateAttributes service) and generates the sequence of the solution steps. +This allows to switch to a different time increment, +a different solution control, etc. If no meta step is specified, the EngngModel +creates a default one for all solution steps. There are two +services, where EngngModel attributes are set or updated. The first one, +used for those attributes which do not vary during the solution +of the problem, are initialized in `instanciateYourself` service. +The `updateAttributes` method is called when specific meta step is activated, and selected attributes +are updated from corresponding meta step attributes. +If no meta step is introduced, a default one is created +(with the attributes set to the EngngModel attributes). +Then there is no difference, whether the attributes are initialized +in instanciateYourself or in updateAttributes, but +the preferred scheme is to read all attributes in instanciateYourself +and to left updateAttributes service empty. + +The basic `EngngModel` tasks are following: + +- Assembling governing equations by summing contributions (typically from nodes and elements). +- Solving the problem described by governing equation(s) using the instance of a + suitable numerical method. This requires to establish a mapping between numerical method-parameters + and EngngModel components of governing equation. + EngngModel must map each component of governing + equation(s) (which has physical meaning) to the corresponding numerical component. + This mapping between physical components to independent numerical components + (understood by the numerical method) is important, because it allows + the numerical method to be used by + many EngngModels with different component meaning and allows to use + different numerical methods by EngngModel. This is achieved by using + the compulsory numerical component names (see further). +- Providing access to the problem solution. Services for returning unknown + values according to their type and mode are provided. These services are used by DOFs to + access their corresponding unknowns. +- Terminating the time step by updating the state of the problem domains (nodes and + elements, including integration points). +- Managing the problem domains, meta steps, and problem input/output streams. +- Equation numbering. +- Storing and restoring problem state to/from context file. +- Managing and updating unknowns + +The complete listing of `EngngModel` class declaration can be found here: https://github.com/oofem/oofem/blob/master/src/oofemlib/engngm.h. It is well commented and should be self-explanatory. + +One of the key methods of `EngngModel` class is +`solveYourself`, which is invoked to starts the solution of the problem. +The default implementation loops over individual metasteps. For each metastep, the loop over nested solution steps is +performed. The representation of solution step (`TimeStep` class instance) is created inside `giveNextStep` service and stored in EngngModel attribute `currentStep`. +After some initializations, the solution step is solved by calling `solveYourselfAt` service, which performs solution for specific solution step, passed as its parameter. + + +The simplified implementation of `solveYourself` service is shown below: + +.. code-block:: cpp + :linenos: + + void + EngngModel :: solveYourself () + { + int imstep, jstep; + int smstep=1, sjstep=1; + MetaStep* activeMStep; + + for (imstep = smstep; imstep<= nMetaSteps; imstep++) { + activeMStep = this->giveMetaStep(imstep); + for (jstep = sjstep; jstep <= activeMStep->giveNumberOfSteps(); jstep++) { + this->giveNextStep(); + // update attributes according to new meta step attributes + if (jstep == sjstep) this->updateAttributes (this->giveCurrentStep()); + this->solveYourselfAt(this->giveCurrentStep()); + this->updateYourself( this->giveCurrentStep() ); + this->terminate( this->giveCurrentStep() ); + + } + } + +The `solveYourselfAt` method typically assembles characteristic matrices and vectors +and solves the problem using the suitable numerical method. The implementation should be provided by derived classes implementing specific problem. +(see section \ref{Engngmodelexample} for an example). +After finishing the solution for the given solution step, `updateYourself` service is called to update the state of all components. Finally `terminate` service is called. + +The default implementation of `updateYourself` service loops over all +problem domains and calls corresponding update service for all DOF +managers and elements: + +.. code-block:: cpp + :linenos: + + void + EngngModel :: updateYourself(TimeStep *tStep) + { + for ( auto &domain: domainList ) { + for ( auto &dman : domain->giveDofManagers() ) { + dman->updateYourself(tStep); + } + for ( auto &elem : domain->giveElements() ) { + elem->updateYourself(tStep); + } + } + +The `terminate`` service essentially prints the +required outputs and optionally saves the +context file (if required), so the solution can be restarted from this +saved state later: + +.. code-block:: cpp + :linenos: + + void + EngngModel :: terminate(TimeStep *tStep) + { + exportModuleManager.doOutput(tStep); + this->saveStepContext(tStep, CM_State | CM_Definition); + } + +Both services are virtual, so they can be easily +tailored to specific needs. + + +The `EngngModel` class comes with handy generic services for characteristic components assembly, that are used by derived classes to assemble the characteristic components of the problem. +They essentially loop over nodes or elements (depending on +the character of the requested component) of the given domain, requesting the +corresponding component (determined or even evaluated by assembler class instance) and corresponding code numbers. +The component contributions are assembled (using code numbers) into +a target array or matrix. Here we show the simplified implementation of one of these services to assemble the characteristic matrix: + + +.. code-block:: cpp + :linenos: + + void EngngModel :: assemble(SparseMtrx &answer, TimeStep *tStep, const MatrixAssembler &ma, + const UnknownNumberingScheme &s, Domain *domain) + { + IntArray loc; + FloatMatrix mat, R; + int nelem = domain->giveNumberOfElements(); + + for ( int ielem = 1; ielem <= nelem; ielem++ ) { + auto element = domain->giveElement(ielem); + ma.matrixFromElement(mat, *element, tStep); + + if ( mat.isNotEmpty() ) { + ma.locationFromElement(loc, *element, s); + if ( element->giveRotationMatrix(R) ) { + mat.rotatedWith(R); + } + if ( answer.assemble(loc, mat) == 0 ) { + OOFEM_ERROR("sparse matrix assemble error"); + } + } + } + } + +The `assemble` service is used to assemble the characteristic matrix from elements contributions. +The `MatrixAssembler` class instance is used to parametrize the `aasemble` method and it determines the element contributions. In the simple form, it can request characteristic matrix directly from element, +but it can also evaluate the element contribution. +The `UnknownNumberingScheme` class instance determines the unknown numbering and thus determines the code numbers of the unknowns. +The `SparseMtrx` class instance is used to store the assembled matrix. + +Numerial Method Interface +------------------------- +The `EngngModel` needs to solve the underlying discrete problem. This is done by the suitable instance of `NumericalMethod` class. +The design attempts to separate the problem formulation from the numerical solution of the problem, and the data storage format. + +Derived classes from `NumericalMethod` class are supposed to declare the interface for specific problem type (like solution of linear system). +The interface usually consist in declaring virtual abstract function `solve`, with parameters corresponding to problem under consideration. +The data are specified using parameters passed to `solve` method (so called mapping of physical components to their numerical counterpart). +The parameters of numerical method either are passed to `solve` method or are set by `instanciateYourself` service from input file. +The `solve` method shoud return value of `NM_Status` type. + +Many problems require updating components during the solution. To keep definition and implementation of numerical method independent on particular problem, the `EngngModel` must also provide service for updating mapped components +components, if this is necessary. This is provided by `EngngModel::updateComponent` method. This method is invoked by numerical method, when the update of some components during solution is needed (for +example in the Newton Raphson algorithm for the solution of non-linear +equations, stiffness or internal force vector need to be updated during the solution process). + + +The derived classes from \class{Numerical method} are supposed to +declare the interface for specific problem type +(like solution of linear system). It should be pointed out, that all numerical methods solving the same +numerical problem have to use the same genaral interface - this is +enforced by introducing the abstract class representing family of numerical method for solving specific problem and declaring the common interface. + +There are typically multiple numerical methods for solving the same problem. +The `NumericalMethod` can implement the solution itself, but it can also implement an interface to external numerical libraries (like PETSc, Trilinos, etc.). + + +This concept is further enhanced by the introduction of a base abstract +class `SparseMatrix` representing sparse matrix storage. This class only declares the basic +required services provided by all sparse matrix implementations (like assembly of contribution, multiplication +by a vector, possible factorization, etc). The implementation is left on +derived classes. Numerical methods are then implemented only +using basic services declared by the `Sparse Matrix` class. Thus, numerical +method class instances will work with any sparse matrix representation, even +added in the future, without changing any code. + +As an example, the declaration of the `SparseLinearSystem` class is shown below. This class is an abstraction for all numerical methods solving sparse linear system of equations. + +.. code-block:: cpp + :linenos: + + class SparseLinearSystemNM : public NumericalMethod + { + public: + /// Constructor. + SparseLinearSystemNM(Domain * d, EngngModel * m); + /// Destructor. + virtual ~SparseLinearSystemNM(); + + /** + * Solves the given sparse linear system of equations @f$ A\cdot x=b @f$. + * @param A Coefficient matrix. + * @param b Right hand side. + * @param x Solution array. + * @return Status of the solver. + */ + virtual ConvergedReason solve(SparseMtrx &A, FloatArray &b, FloatArray &x) = 0; + + /** + * Solves the given sparse linear system of equations @f$ A\cdot X=B @f$. + * Default implementation calls solve multiple times. + * @param A Coefficient matrix. + * @param B Right hand side. + * @param X Solution matrix. + * @return Status of the solver. + */ + virtual ConvergedReason solve(SparseMtrx &A, FloatMatrix &B, FloatMatrix &X); + }; + +To summarize, the natural independence of the problem formulation, +numerical solution of the problem, and data storage format have been +obtained, which leads to a modular and extensible structure. + +Domain class +------------ +The computational grid is represented by `Domain` class. +It manages all components of the FEM discrete model. These include dof managers +(nodes, element sides possessing DOFs), elements, material and cross +section models, boundary and initial conditions, time functions, and so on. +For every component type `Domain` maintains the +component list and provides the corresponding access services. + +The basic services provided by Domain are the following: + +- Reading its description from input and creating corresponding objects. + This task includes the reading and parsing the particular mesh input + records, creating the corresponding components representations + (objects) of appropriate type, initializing these components using + their `instanciteFromString` methods and storing them into + corresponding list. +- Provides services for accessing its particular components. + The services returning the total number of particular domain + components and particular component access methods based on component + number are provided. + +The domain also manages instances of +`SpatialLocalizer` and `connectivityTable` classes +to serve the connectivity and spatial localization related services +(finding elements shared by the node, finding the closest node search, +finding the element containing given point, etc.). + +For complete definition of `Domain` class interface, +please go to https://github.com/oofem/oofem/blob/master/src/oofemlib/domain.h + + + +Example - Linear Static Analysis implementation +----------------------------------------------- + +In this section, the example of the implementation of linear static +analysis will be given. +The linear static analysis is a typical example of a structural engineering problem. +In this particular case, the analysis is time independent, meta steps are not used (default +one is created) and time steps are used to distinguish load cases (different load vectors). + +The class definition includes the declaration of characteristic +components of the problem - the stiffness matrix and load and +displacement vectors. Two additional variables are used to store the +linear solver type and the sparse matrix type, which can be selected by the user. +Finally, the reference to suitable instance of `SparseLinearSystemNM` class is stored in the `nMethod` attribute. + +The following services are declared/implemented: +- `solveYourselfAt` for solving the solution step, responsible for forming the stiffness matrix and load vector, and calling the numerical method to solve the problem, +- `giveUnknownComponent` providing access to problem unknowns (displacements), +- context i/o services for serializing and deserializing the state of the problem (`saveContext` and `restoreContext` services), +- solver parameter initialization (`initializeFrom`) and consistency checking (`checkConsistency`). + + +.. code-block:: cpp + :linenos: + + class LinearStatic : public StructuralEngngModel + { + protected: + std :: unique_ptr< SparseMtrx > stiffnessMatrix; + FloatArray loadVector; + FloatArray displacementVector; + + LinSystSolverType solverType; + SparseMtrxType sparseMtrxType; + /// Numerical method used to solve the problem. + std :: unique_ptr< SparseLinearSystemNM > nMethod; + + int initFlag; + EModelDefaultEquationNumbering equationNumbering; + + public: + LinearStatic(int i, EngngModel *master = nullptr); + virtual ~LinearStatic(); + + void solveYourself() override; + void solveYourselfAt(TimeStep *tStep) override; + + double giveUnknownComponent(ValueModeType type, TimeStep *tStep, Domain *d, Dof *dof) override; + void saveContext(DataStream &stream, ContextMode mode) override; + void restoreContext(DataStream &stream, ContextMode mode) override; + + void updateDomainLinks() override; + + TimeStep *giveNextStep() override; + NumericalMethod *giveNumericalMethod(MetaStep *mStep) override; + + void initializeFrom(InputRecord &ir) override; + + virtual UnknownNumberingScheme &giveEquationNumbering() { return equationNumbering; } + + // identification + virtual const char *giveInputRecordName() const { return _IFT_LinearStatic_Name; } + const char *giveClassName() const override { return "LinearStatic"; } + }; + + +The implementation of the \class{LinearStatic} class and its methods follows. +First, we start with `initializeFrom` method, responsible for reading user input parameters. The input record is represented by instance of `InputRecord` class, which allows for key-value lookup. +The `LinearStatic` reads the solver type and sparse matrix type from the input record and stores them in the corresponding attributes. The error handling is achieved using exceptions thrown by `IR_GIVE_OPTIONAL_FIELD` macros, +which is defined in the `InputRecord` class. + +.. code-block:: cpp + :linenos: + + void + LinearStatic :: initializeFrom(InputRecord &ir) + { + // call parent class + StructuralEngngModel :: initializeFrom(ir); + + int val = 0; + IR_GIVE_OPTIONAL_FIELD(ir, val, _IFT_EngngModel_lstype); + solverType = ( LinSystSolverType ) val; + + val = 0; + IR_GIVE_OPTIONAL_FIELD(ir, val, _IFT_EngngModel_smtype); + sparseMtrxType = ( SparseMtrxType ) val; + + } + +The `giveNumericalMethod` method is responsible for allocating and returning the suitable instance numerical method. The method uses class factory to create the instance of the sparse linear solver. + +.. code-block:: cpp + :linenos: + + NumericalMethod *LinearStatic :: giveNumericalMethod(MetaStep *mStep) + { + if ( !nMethod ) { + nMethod = classFactory.createSparseLinSolver(solverType, this->giveDomain(1), this); + } + if ( !nMethod ) { + OOFEM_ERROR("linear solver creation failed for lstype %d", solverType); + } + return nMethod.get(); + } + + +The `giveUnknownComponent` method provides access to problem unknowns, in our case to displacement vector. the unknown component of the problem. The method is called by the numerical method to access the unknowns (displacements) of the problem. + +.. code-block:: cpp + :linenos: + + double LinearStatic :: giveUnknownComponent(ValueModeType mode, TimeStep *tStep, Domain *d, Dof *dof) + { + // get DOF equation number + int eq = dof->__giveEquationNumber(); + + if ( tStep != this->giveCurrentStep() ) { + OOFEM_ERROR("unknown time step encountered"); + return 0.; + } + + switch ( mode ) { + case VM_Total: + case VM_Incremental: + if ( displacementVector.isNotEmpty() ) { + return displacementVector.at(eq); + } else { + return 0.; + } + + default: + OOFEM_ERROR("Unknown is of undefined type for this problem"); + } + + return 0.; + } + +Finally, we provide the implementation of the `solveYourselfAt` method, which is responsible for solving the problem at the given time step representing load-case. +The method first assembles the stiffness matrix and load vector, and then calls the numerical method to solve the problem. + + +.. code-block:: cpp + :linenos: + + void LinearStatic :: solveYourselfAt(TimeStep *tStep) + { + // initFlag is used to avoid assembling stiffness matrix for each load-case + if ( initFlag ) { + OOFEM_LOG_DEBUG("Assembling stiffness matrix\n"); + stiffnessMatrix = classFactory.createSparseMtrx(sparseMtrxType); + if ( !stiffnessMatrix ) { + OOFEM_ERROR("sparse matrix creation failed"); + } + + stiffnessMatrix->buildInternalStructure( this, 1, this->giveEquationNumbering() ); + // use TangentAssembler to assemble the stiffness matrix + this->assemble( *stiffnessMatrix, tStep, TangentAssembler(TangentStiffness), + this->giveEquationNumbering(), this->giveDomain(1) ); + initFlag = 0; + } + // allocate space for displacementVector + displacementVector.resize( this->giveNumberOfDomainEquations( 1, this->giveEquationNumbering() ) ); + displacementVector.zero(); + loadVector.resize( this->giveNumberOfDomainEquations( 1, this->giveEquationNumbering() ) ); + loadVector.zero(); + + OOFEM_LOG_DEBUG("Assembling load\n"); + this->assembleVector( loadVector, tStep, ExternalForceAssembler(), VM_Total, + this->giveEquationNumbering(), this->giveDomain(1) ); + + // assemble internal part of load vector (forces induced by prescribed displacements, etc.) + FloatArray internalForces( this->giveNumberOfDomainEquations( 1, this->giveEquationNumbering() ) ); + internalForces.zero(); + this->assembleVector( internalForces, tStep, InternalForceAssembler(), VM_Total, + this->giveEquationNumbering(), this->giveDomain(1) ); + + loadVector.subtract(internalForces); + + OOFEM_LOG_INFO("\n\nSolving ...\n\n"); + + this->giveNumericalMethod( this->giveMetaStep( tStep->giveMetaStepNumber() ) ); + ConvergedReason s = nMethod->solve(*stiffnessMatrix, loadVector, displacementVector); + if ( s != CR_CONVERGED ) { + OOFEM_ERROR("No success in solving system."); + } + } + +Please refer to full source code of the `LinearStatic` class in the OOFEM source code repository for more details: https://github.com/oofem/oofem/blob/master/src/sm/EngineeringModels/linearstatic.C diff --git a/doc/developerGuide/figs/elementmaterialframe.jpg b/doc/developerGuide/figs/elementmaterialframe.jpg new file mode 100755 index 000000000..ea7de4bae Binary files /dev/null and b/doc/developerGuide/figs/elementmaterialframe.jpg differ diff --git a/doc/developerGuide/figs/elementmaterialframe.png b/doc/developerGuide/figs/elementmaterialframe.png new file mode 100755 index 000000000..9a8afbcc5 Binary files /dev/null and b/doc/developerGuide/figs/elementmaterialframe.png differ diff --git a/doc/developerGuide/figs/engngmframe.jpg b/doc/developerGuide/figs/engngmframe.jpg new file mode 100755 index 000000000..e11125923 Binary files /dev/null and b/doc/developerGuide/figs/engngmframe.jpg differ diff --git a/doc/developerGuide/figs/engngmframe.png b/doc/developerGuide/figs/engngmframe.png new file mode 100755 index 000000000..0e871345e Binary files /dev/null and b/doc/developerGuide/figs/engngmframe.png differ diff --git a/doc/developerGuide/figs/general.png b/doc/developerGuide/figs/general.png new file mode 100755 index 000000000..d159e48a2 Binary files /dev/null and b/doc/developerGuide/figs/general.png differ diff --git a/doc/developerGuide/figs/isotropicdamagematerial.png b/doc/developerGuide/figs/isotropicdamagematerial.png new file mode 100755 index 000000000..632ca9ee0 Binary files /dev/null and b/doc/developerGuide/figs/isotropicdamagematerial.png differ diff --git a/doc/developerGuide/figs/truss2dclass.png b/doc/developerGuide/figs/truss2dclass.png new file mode 100755 index 000000000..d38ae9795 Binary files /dev/null and b/doc/developerGuide/figs/truss2dclass.png differ diff --git a/doc/developerGuide/general_structure.rst b/doc/developerGuide/general_structure.rst new file mode 100644 index 000000000..b5ec89f6b --- /dev/null +++ b/doc/developerGuide/general_structure.rst @@ -0,0 +1,58 @@ + +**************************************************** +General Structure +**************************************************** + + +General structure is shown in Fig (fig-generalstructure_). +The key class is `EngineeringModel` representing the problem +under consideration. It can contain one or more domains (abstractions +for computational mesh) represented by the `Domain` class. +Generally +speaking, it contains the domain description, or if the program runs in +parallel, then it contains the description of the domain associated +with a particular processor or thread of execution. `Domain` class +contains and manages lists of degree of freedom managers, elements, boundary +conditions, cross sections, and material models - these describe the geometry +of the problem, its constitutive properties, and applied boundary +conditions. Services for accessing each of these objects are +provided. +`Domain` class & object provides services for reading input +files and instantiating corresponding components accordingly. + +.. figure:: figs/general.png + :alt: OOFEM top level class structure + :name: fig-generalstructure + :width: 70.0% + + OOFEM Top level structure + + +The `EngngModel` class is an abstraction for the problem under +consideration. It represents the type of analysis to be performed. +Base class declares and implements the basic general services for assembling +characteristic components and services for starting the solution step and +its termination. Derived classes know the form of governing +equation and the physical meaning of particular components. +They are responsible for forming the governing equation for each solution +step, usually by summing contributions from particular elements and +nodes. The underlying discrete problem is solved by suitable instance of `NumericalMethod` class, that can take advantage of efficient sparse store for characteristic matrices, represented here by `SparseMtrx` class. +This part is described in detail in `Problem representation - Engineering model`_. + +Class `Element`, is an abstraction of a finite element. Element manages its DofManagers (nodes), and has its cros section and material models defined by `CrossSection` and `Material` class instances. +Element manages its Integration rules composed of individual integration points and can also have its internal DOFs. + +`DOF` class is an abstraction for a single degree of freedom (DOF). It maintains +its physical meaning and associated equation number. `DOF` is +the attribute of `DofManager` class, which manages the collection +of DOFs. A typical derived class is class `Node`, representing a node in a finite element mesh. + +`BoundaryCondition` and `InitialCondition` classes are abstractions of boundary and +initial conditions. They are attributes of `Domain` class and are associated +with one or more DOFs. The abstract class `Load`, derived from parent `BoundaryCondition` +class, is an abstraction for load. It is an attribute of Domain +and can be associated with several dof managers or elements, according to +the type of loading it represents. The class declares the basic services provided by +all derived classes. Derived classes declare specific load type dependent +services and implement all necessary services. + diff --git a/doc/developerGuide/iga.rst b/doc/developerGuide/iga.rst new file mode 100644 index 000000000..5a34273e0 --- /dev/null +++ b/doc/developerGuide/iga.rst @@ -0,0 +1,151 @@ + +IGA Module +=========== + +In the traditional FEA context, `Element` class is parent +class for finite elements. It maintains list of nodes, boundary +conditions (loads), integration rules, it keeps links to its +interpolation and associated material model and provides general +services for accessing its attributes, methods for returning its code +numbers, and abstract services for the evaluation of characteristic +components (e.g. stiffness matrix, load vector, etc.). In the proposed +IGA module, the individual NURBS (or B-spline) +patches are represented by classes derived from the base +`IGAElement` class which is in turn derived from `Element` +class. As a consequence, the B-spline patch is represented and treated as +a single entity, which returns its contributions that are localized into +global system of characteristic equations. This is important also in the +sense of slightly different handling of primary unknowns, compared to the standard FEA. +Moreover, it is quite natural because in a general case, degrees of +freedom (DOFs) on all nodes (control points) of the patch may interact +with each other. + +One of the fundamental issues, that has to be addressed at the element +level, is the integration. The integration, usually the Gaussian +integration, is performed over the nonzero knot spans. Individual +integration points are represented +by `GaussPoint` class. They maintain their spatial +coordinates and corresponding integration weights. The individual +integration points are set up and grouped together by base +`IntegrationRule` class. For example, +`GaussIntegrationRule` class, derived from +`IntegrationRule` base, implements Gauss quadrature. An +important feature is that an element may have several integration +rules. This is very useful for the implementation of the reduced or selective +integration, for example. The concept of multiple integration rules +per element is extended in the present context of the IGA. The +`IGA_IntegrationElement` class is introduced to represent the +integration rule for individual nonzero knot spans. Since it is derived from +`GaussIntegrationRule`, it inherits the capability to set up +Gauss integration points. The reason for creating a new class is to +introduce the new attribute `knotSpan`, where the +corresponding knot span is stored. This information is used in +interpolation class to evaluate corresponding basis functions and +their derivatives at a given integration point. Note that generally, the +active knot span can be determined for each integration point on the +fly whenever it is needed, but in our approach this information is stored to save +the computational time. The `IGA_IntegrationElement` instances +are set up for each nonzero knot span. The element integration then +consists of a loop over individual nonzero knot spans, i.e. the loop over +`IGA\_IntegrationElements` and by inner loop over the individual +integration points of the particular knot span. + +The individual IGA elements are derived from `IGAElement` class, +further derived from the base `Element`. The purpose of `IGAElement` +class is to provide general method for initialization of individual +integration rules on nonzero knot spans (represented by +`IGA_IntegrationElement` class). The integration rules provide +methods to create individual integration points in parametric +space. An efficient implementation requires to map coordinates of +individual integration points with parametric coordinates related to +knot spans directly to knot vector based space. Specific elements are +derived from the base `Element` (or `IGAElement` class), that +delivers the generic element part and also from one or more classes +implementing problem-specific functionality, such as +`BSplinePlaneStressElement`. In the presented approach, +`BSplinePlaneStressElement` is derived from `StructuralElementEvaluator`, which is an abstract base class, that +defines the interface for structural analysis, which includes methods +to evaluate mass and stiffness matrices, load vectors, etc. Some of +the methods are already implemented at this level, such as stiffness +matrix evaluation, based on declared abstract services (evaluation of +strain-displacement matrix, etc.), which have to be implemented by +derived classes. The example of the evaluation of the element stiffness matrix, +which can be used by both classical and IGA based elements, is +presented using symbolic +code: + +.. code-block:: c++ + + StructuralElementEvaluator::computeStiffnessMatrix() { + loop on all integration rules of the element: + loop on all Gauss points of the IntegrationRule: + B = this->computeStrainDisplacementMatrix(gp); + D = this->computeConstitutiveMatrix(gp); + dV = this->computeVolumeAround(gp); + stiffnessMatrix->add(product of B^T_D_B_dV); + } + + +In the structural analysis context, classes derived from +`StructuralElementEvaluator` implement desired functionality for +specific types of structural analyzes (plane-stress, plane-strain, +full 3D, etc). Provided that the element defines its interpolation +(B-spline basis functions), it is +possible to evaluate remaining abstract methods from +`StructuralElementEvaluator` interface. Thus, when a new element is +defined, it has to create its own interpolation and should be derived from +`Element` class, which delivers the general basic element +functionality and from one or more evaluators, implementing +analysis-specific functionality. Such a design, based on +decoupled representation of element interpolation and problem specific +evaluators, has several advantages. It allows to define problem +specific methods only once for several elements with different geometry and +interpolation and allows straightforward implementation of elements +for multi-physics simulations. + +.. code-block:: c++ + + PlaneStressStructuralElementEvaluator:: + computeStrainDisplacementMatrix(IntegrationPoint gp) { + FEInterpolation interp = gp->giveElement()->giveInterpolation(); + interp->evalShapeFunctDerivatives (der, gp); + + answer.resize(3, nnode*2); // 2 DOFs per each node + answer.zero(); + + for i=1:nnode + // epsilon_x + answer.at(1, i*2-1) = der.at(i, 1); // dN(i)/dx + // epsilon_y + answer.at(2, i*2) = der.at(i, 2); // dN(i)/dy + // shear strain + answer.at(3, i*2-1) = der.at(i, 2); // dN(i)/dy + answer.at(3, i*2) = der.at(i, 1); // dN(i)/dx + } + + +The description of the element interpolation is encapsulated into a class +derived from `FEInterpolation` class which defines the +abstract interface in terms of services that evaluate shape +functions, their derivatives, jacobian matrix, etc. at given +point. In the frame of presented work, the +`BSplineInterpolation` class has been implemented. +Each finite element has to set up its +interpolation and provide access to it. This is enforced by general +`Element` interface, that requires to define the method for +accessing element interpolation. The abstract `FEInterpolation` +class interface is essential, as it allows to implement problem +specific element methods already at the top level (like the evaluation of +element interpolation or strain-displacement matrices). An efficient +implementation should profit from the locality of +individual interpolation functions which have limited support over +several consecutive knot spans. Therefore methods +declared by `FEInterpolation` class evaluating values of +interpolation functions or their derivatives return the values +only for those, that are nonzero in actual knot span. This +enables to compute characteristic element contributions on a knot span +basis efficiently. For each individual knot span, the contributions are +computed only for generally nonzero shape functions and then are +localized into element contribution. The mask of nonzero shape +functions for individual knot spans can be evaluated using `giveKnotBasisFuncMask` service declared by +`FEInterpolation` and implemented by `BSplineInterpolation`. \ No newline at end of file diff --git a/doc/developerGuide/index.rst b/doc/developerGuide/index.rst new file mode 100644 index 000000000..eb0babb05 --- /dev/null +++ b/doc/developerGuide/index.rst @@ -0,0 +1,32 @@ +.. OOFEM Developer guide documentation master file, created by + sphinx-quickstart on Fri Jun 7 13:48:46 2024. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to OOFEM Developer guide's documentation! +================================================= + +.. toctree:: + :maxdepth: 4 + :caption: Contents: + + introduction + coding_standards + general_structure + engng_frame.rst + dofmanagers.rst + element_frame.rst + material_frame.rst + utilityclasses.rst + xfem.rst + iga.rst + + about + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` + \ No newline at end of file diff --git a/doc/developerGuide/introduction.rst b/doc/developerGuide/introduction.rst new file mode 100644 index 000000000..b131be732 --- /dev/null +++ b/doc/developerGuide/introduction.rst @@ -0,0 +1,22 @@ +************************************************************ +Introduction +************************************************************ + +The aim of OOFEM project is to develop efficient and robust tool for +FEM computations as well as to provide modular and extensible +environment for future development. + +The aim of this document is to provide the introduction to understand the OOFEM +principles and internal structure, and provides commented examples how to implement new components, such as custom elements, material models, or even new problem formulations. + +The OOFEM is divided into several modules. The core module, called OOFEMlib, introduces the fundamental, core classes. These classes are problem independent +and they provide the common definitions and support to remaining modules. +The other modules typically implement problem specific parts, such as elements, materials, solvers, etc. +The OOFEMlib module is the compulsory module, that is always included in all builds. The other modules are optional and can be included or excluded from the build, depending on the user configuration. + +The OOFEM package is written in C++. This +document contains many examples and listings of a parts of the source +code. Therefore, the ideal reader should be familiar with C++ programming +language. However, any reader with an object-oriented background should +follow this document, since the examples are written in a form, which is hopefully +easy to read and understand. diff --git a/doc/developerGuide/make.bat b/doc/developerGuide/make.bat new file mode 100644 index 000000000..32bb24529 --- /dev/null +++ b/doc/developerGuide/make.bat @@ -0,0 +1,35 @@ +@ECHO OFF + +pushd %~dp0 + +REM Command file for Sphinx documentation + +if "%SPHINXBUILD%" == "" ( + set SPHINXBUILD=sphinx-build +) +set SOURCEDIR=. +set BUILDDIR=_build + +%SPHINXBUILD% >NUL 2>NUL +if errorlevel 9009 ( + echo. + echo.The 'sphinx-build' command was not found. Make sure you have Sphinx + echo.installed, then set the SPHINXBUILD environment variable to point + echo.to the full path of the 'sphinx-build' executable. Alternatively you + echo.may add the Sphinx directory to PATH. + echo. + echo.If you don't have Sphinx installed, grab it from + echo.https://www.sphinx-doc.org/ + exit /b 1 +) + +if "%1" == "" goto help + +%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% +goto end + +:help +%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% + +:end +popd diff --git a/doc/developerGuide/material_frame.rst b/doc/developerGuide/material_frame.rst new file mode 100644 index 000000000..b05bd2630 --- /dev/null +++ b/doc/developerGuide/material_frame.rst @@ -0,0 +1,618 @@ + +Material models +================= + +The base class for all material models is the `Material` class, +derived from the `FEMComponent` parent. It declares analysis independent +part of the material interface. The analysis specific part of +the interface should be introduced by derived classes, which are supposed to represent the base +classes for specific problem. The typical example is +`StructuralMaterial` class which declares the services of material model +necessary for the structural analysis. +The generic services declared or implemented at top `Material` level include + +- Material status related services. The material model has to be able to + create instance of corresponding material status, where the history + variables are stored. This is done by invoking `CreateStatus`. + The status corresponding to a given integration point can be requested + using the `giveStatus` service. +- Services for integration point update and initialization. There are + generally two sets of + history variables kept in corresponding material statuses for each + integration point. One set is referring to previous equilibrated + state, the second one to the actual state during the solution (more precisely to + the achieved local-equilibrium state), which may not + correspond to the global equilibrium state. The methods are provided to update + the actual state as equilibrated (`updateYourself` service) and for + initialization of actual state to previous equilibrium + (`initTempStatus`). The implementation of these services + simply extract the corresponding status of a given integration point and + calls the corresponding service of material status. +- Services for testing the material model capabilities + (`testMaterialExtension`, `hasMaterialModeCapability`, + and `hasNonLinearBehaviour` services). +- Services for requesting internal variables and properties. + +Analysis specific material model classes +---------------------------------------- + +The direct derived classes of the `Material` class, such as `StructuralMaterial` are supposed +to declare the analysis specific +part of the material model interface, which is required (and assumed) +by the corresponding +element class (`StructuralElement`) and cross section class +(`StructuralCrossSection`). + +To store all necessary history variables of the material model, so called +status concept is adopted. The material status can be thought as +container of all necessary history variables. Usually two kinds of +these variables are stored. The temporary ones refer to the actual +state of an integration point, but do not necessary correspond to +the global equilibrium. These are changing during global equilibrium search +iteration. The non-temporary variables are related to the +previously converged state. +For each material model, the corresponding twin status has to be defined, +and the unique instance for each integration point has to be created +and associated with it. The integration point provides the services for +accessing corresponding status. +All material statuses, related to particular material models, have +to be derived from the base `MaterialStatus` class. This class +declares the basic status interface. The two most important services +are: + +- `initTempStatus` intended to initialize the temporary + internal variables according to variables related to previously reached + equilibrium state, +- `updateYourself` designed to update the + equilibrium-like history variables according to temporary variables, + when the new global equilibrium has been reached. The derived classes + should also define methods for accessing the corresponding history + variables. + + +Structural Material class - Example +----------------------------------- + +The structural (or mechanical) constitutive model should generally +support several so-called material models, corresponding to various +modeling assumptions (plane-stress, plane-strain, or 1D-behavior, +for example). The concept of multiple material modes is generally +supported by `Material` class, which provides the services for testing +the model capabilities. It is generally assumed, that results obtained +from constitutive model services are formed according to +material mode. This mode is attribute of each integration point, +which is compulsory parameter of all material services. For +computational convenience, the so-called full and reduced formats of +stress/strains vectors are introduced, corresponding to material +modes. +The full format includes all components, even if they are zero due to stress/strain mode nature. +In the reduced format, only generally nonzero components are stored. +(Full format should be used only if absolutely necessary, to avoid +wasting of space. For example, it is used +by output routines to print results in general form). Methods for converting vectors between +full and reduced format are provided. If possible, all computations +should be performed in reduced space. + +:: + + The convention used to construct reduced strain/stress vectors is as follows: + If in a particular mode a particular stress component is zero, the corresponding strain is not computed + and not stored in reduced vector, and in full vector there is zero value on corresponding position. + On the other hand, if zero strain component is imposed, then this condition must be taken into + account in geometrical relations (at element level), and corresponding components are included + in stress/strain reduced vectors. + +Generally, the following major tasks are declared by +`StructuralMaterial` or inherited from `Material` class: + +- Computing the real stress vector (tensor) at an integration point for + a given strain increment and updating its temporary state corresponding to + the local equilibrium, but not necessarily to the global equilibrium (see + `giveRealStressVector`). The parameters include the total strain + vector and the corresponding integration point. + The total strain is defined as strain computed directly from the + displacement field at a given time. + The stress independent parts (temperature, eigen strains) should be + subtracted and the corresponding load-history variables + (stored in the corresponding status) can be used. The temporary + history variables in the status should be updated according to the newly reached state. + The temporary history variables are moved into equilibrium history + variables just after the global structure + equilibrium has been reached by the iteration process. +- Updating the integration point state (final state), when the global equilibrium + has been reached. +- Returning material stiffness and/or flexibility matrices for + a given material mode. The general methods computing the response for + the specific material mode are provided, based on converting 3D stiffness + or compliance matrix to that corresponding to the specific material mode. + But, if it is possible to compute stiffness or + compliance matrix directly for the specific mode, then these general methods should be + overloaded. +- Storing/restoring integration point state to/from a stream. +- Requesting internal variables, their types and properties + (`giveIPValue`, `giveIPValueSize`, + `giveIPValueType`, and `giveIntVarCompFullIndx` services). +- Returning material properties. + + +Structural material services should not be called directly by +elements. Instead, the elements should +pass their requests to the corresponding cross section model, that performs all necessary integration over +its volume and invokes corresponding material model services. + +The `StructuralMaterial` class comes with definition of +associated material status - `StructuralMaterialStatus`. +This is only an abstract class. For every instance of +`StructuralMaterial` class +there should be a twin statu class, which defines and maintains all necessary state variables. +The `StructuralMaterialStatus` only introduces attributes common to all structural analysis material models - the +strain and stress vectors (referring both to temporary state, corresponding to +the local +equilibrium and non-temporary ones, corresponding to the global equilibrium). The corresponding services +for accessing, setting, initializing, and updating these attributes are provided. + +Isotropic Damage Model - Example +-------------------------------- +In this section, the implementation of ann isotropic damage model will be +described. To cover the various models based on isotropic damage concept, +a base class `IsotropicDamageMaterial` is defined first, +declaring the necessary services and providing the implementation of +them, which are general. The derived classes then only implement a particular +damage-evolution law. + +The isotropic damage models are based on the simplifying assumption +that the stiffness degradation is isotropic, i.e., stiffness moduli +corresponding to different directions decrease proportionally and +independently of direction of loading. Consequently, the damaged +stiffness matrix is expressed as + +.. math:: + {D} = (1-\omega){D}_e, + +where :math:`{D}_e` is elastic stiffness matrix of the undamaged +material and :math:`\omega` is the damage parameter. Initially, :math:`\omega` is +set to zero, representing the virgin undamaged material, and the response is +linear-elastic. As the material undergoes the deformation, the +initiation and propagation of microdefects decreases the stiffness, +which is represented by the growth of the damage parameter :math:`\omega`. +For :math:`\omega=1`, the stiffness completely disappears. + +In the present context, the :math:`D` matrix represents the secant +stiffness that relates the total strain to the total stress + +.. math:: + {\sigma}={D}{\varepsilon} = (1-\omega){D}_e{\varepsilon}. + +Similarly to the theory of plasticity, a loading function $f is +introduced. In the damage theory, it is natural to work in the strain +space and therefore the loading function is depending on the strain +and on an additional parameter :math:`\kappa`, describing the evolution of +the damage. Physically, :math:`\kappa` is a scalar measure of the +largest strain level ever reached. The loading function usually has +the form + +.. math:: + f({\varepsilon}, \kappa) = \tilde\varepsilon({\varepsilon}) - \kappa, + +where :math:`\tilde\varepsilon` is the equivalent strain, i.e., the scalar +measure of the strain level. +Damage can grow only if current state reaches the boundary of elastic +domain (:math:`f=0`). This is expressed by the following loading/unloading +conditions + +.. math:: + f \le 0,\;\;\dot\kappa \ge0,\;\;\dot\kappa f = 0. + +It remains to link the variable :math:`\kappa` to the damage parameter +:math:`\omega`. As both :math:`\kappa` and :math:`\omega` grow monotonically, it is +convenient to postulate an explicit evolution law + +.. math:: + \omega = g(\kappa). + +The important advantage of this explicit formulation is that the +stress corresponding to the given strain can be evaluated directly, +without the need to solve the nonlinear system of equations. +For the given strain, the corresponding stress is computed simply by +evaluating the current equivalent strain, updating the maximum +previously reached equivalent strain value :math:`\kappa` and the damage +parameter and reducing the effective stress according to :math:`{\sigma} += (1-\omega){D}_e {\varepsilon}`. + +This general framework for computing stresses and +stiffness matrix is common for all material models of this type. +Therefore, it is natural to introduce +the base class for all isotropic-based damage models which provides the general +implementation for the stress and stiffness matrix evaluation +algorithms. The particular models then only provide their equivalent +strain and damage evolution law definitions. +The base class only declares the virtual services for computing equivalent +strain and corresponding damage. The implementation of common services +uses these virtual functions, but they are only declared at +`IsotropicDamageMaterial` class level and have to be +implemented by the derived classes. + +Together with the material model, the corresponding status has to be +defined, containing all necessary history variables. +For the isotropic-based damage models, the only history variable is +the value of the largest strain level ever reached (:math:`\kappa`). +In addition, the corresponding damage level $\omega$ will be stored. +This is not necessary because damage can be always computed from +corresponding :math:`\kappa`. +The `IsotropicDamageMaterialStatus` class is derived from +`StructuralMaterialStatus` class. The base class represents the +base material status class for all structural statuses. At +`StructuralMaterialStatus` level, the attributes common to all +structural analysis material models - the strain and +stress vectors (both the temporary and non-temporary) are introduced. The +corresponding services for accessing, setting, initializing, and +updating these attributes are provided. +Therefore, only the :math:`\kappa` and :math:`\omega` parameters are introduced +(both the temporary and non-temporary). The corresponding services for +manipulating these attributes are added and services for context +initialization, update, and store/restore operations are overloaded, to +handle the history parameters properly. + +.. //www.plantuml.com/plantuml/png/SoWkIImgAStDuN9CAYufIamkKKZEIImkLl1DB4ajoap440ykAIfDBYajIip1fSApEB-aAByWCzabCJSnFHMk39SDmIM99QN51En1gCDj2K8D5uolO5EZgulDpGWX5AMu7Ozg0rWnRZVYai1j1qAlGsfU2Z0-0000 + +.. figure:: figs/isotropicdamagematerial.png + :alt: Isotropic Damage Material Model, its associated status inheritance + :name: fig-isotropic-damage-material + :width: 70.0% + +The declaration of the `IsotropicDamageMaterialStatus` class follows: + +.. code-block:: cpp + :linenos: + + class IsotropicDamageMaterialStatus : public StructuralMaterialStatus { + protected: + /// scalar measure of the largest strain level ever reached in material + double kappa; + /// non-equilibrated scalar measure of the largest strain level + double tempKappa; + /// damage level of material + double damage; + /// non-equilibrated damage level of material + double tempDamage; + + public: + /// Constructor + IsotropicDamageMaterialStatus (int n, Domain*d, GaussPoint* g) ; + /// Destructor + ~IsotropicDamageMaterialStatus (); + + /// Prints the receiver state to stream + void printOutputAt (FILE *file, TimeStep* tStep) ; + + /// Returns the last equilibrated scalar measure + /// of the largest strain level + double giveKappa () {return kappa;} + /// Returns the temp. scalar measure of the + /// largest strain level + double giveTempKappa () {return tempKappa;} + /// Sets the temp scalar measure of the largest + /// strain level to given value + void setTempKappa (double newKappa) { tempKappa = newKappa;} + /// Returns the last equilibrated damage level + double giveDamage () {return damage;} + /// Returns the temp. damage level + double giveTempDamage () {return tempDamage;} + /// Sets the temp damage level to given value + void setTempDamage (double newDamage) { tempDamage = newDamage;} + + + // definition + char* giveClassName (char* s) const + { return strcpy(s,"IsotropicDamageMaterialModelStatus") ;} + classType giveClassID () const + { return IsotropicDamageMaterialStatusClass; } + + /** + Initializes the temporary internal variables, + describing the current state according to + previously reached equilibrium internal variables. + */ + virtual void initTempStatus (); + /** + Update equilibrium history variables + according to temp-variables. + Invoked, after new equilibrium state has been reached. + */ + virtual void updateYourself(TimeStep*); + + // saves current context(state) into stream + /** + Stores context of receiver into given stream. + Only non-temp internal history variables are stored. + @param stream stream where to write data + @param obj pointer to integration point, which invokes this method + @return nonzero if o.k. + */ + contextIOResultType saveContext (FILE* stream, void *obj = NULL); + /** + Restores context of receiver from given stream. + @param stream stream where to read data + @param obj pointer to integration point, which invokes this method + @return nonzero if o.k. + */ + contextIOResultType restoreContext(FILE* stream, void *obj = NULL); + }; + +The base `IsotropicDamageMaterial` class is derived +from the `StructuralMaterial` class. +The generic methods defined by `StructuralMaterial` require only to implement two fundamental services: + +- `give3dMaterialStiffnessMatrix` for evaluating the material stiffness matrix in full, 3D mode, +- `giveRealStressVector_3d` for computing the real stress vector in 3D mode. + +The remaining material modes are derived from these two basic services. +However, the derived classes can reimplement (overload) these services, when desired. In our case, it is possible to obtain reduced stress and stiffness in more efficient way, than done in generic way on `StructuralMaterial` level and which requires matrix inversion. +Therefore, the services for reduced modes are overloaded. + +.. code-block:: cpp + :linenos: + + class IsotropicDamageMaterial : public StructuralMaterial + { + protected: + /// Coefficient of thermal dilatation. + double tempDillatCoeff = 0.; + + /// Maximum limit on omega. The purpose is elimination of a too compliant material which may cause convergence problems. Set to something like 0.99 if needed. + double maxOmega = 0.999999; + + /// Indicator of the type of permanent strain formulation (0 = standard damage with no permanent strain) + int permStrain = 0; + + /// Reference to bulk (undamaged) material + LinearElasticMaterial *linearElasticMaterial = nullptr; + /** + * Variable controlling type of loading/unloading law, default set to idm_strainLevel + * defines the two two possibilities: + * - idm_strainLevelCR the unloading takes place, when strain level is smaller than the largest level ever reached; + * - idm_damageLevelCR the unloading takes place, when damage level is smaller than the largest damage ever reached; + */ + enum loaUnloCriterium { idm_strainLevelCR, idm_damageLevelCR } llcriteria = idm_strainLevelCR; + + public: + /// Constructor + IsotropicDamageMaterial(int n, Domain *d); + /// Destructor + virtual ~IsotropicDamageMaterial(); + + bool hasMaterialModeCapability(MaterialMode mode) const override; + const char *giveClassName() const override { return "IsotropicDamageMaterial"; } + + /// Returns reference to undamaged (bulk) material + LinearElasticMaterial *giveLinearElasticMaterial() { return linearElasticMaterial; } + + FloatMatrixF<6,6> give3dMaterialStiffnessMatrix(MatResponseMode mode, GaussPoint *gp, TimeStep *tStep) const override; + + void giveRealStressVector(FloatArray &answer, GaussPoint *gp, + const FloatArray &reducedStrain, TimeStep *tStep) override; + + FloatArrayF<6> giveRealStressVector_3d(const FloatArrayF<6> &strain, GaussPoint *gp, TimeStep *tStep) const override + { + FloatArray answer; + const_cast(this)->giveRealStressVector(answer, gp, strain, tStep); + return answer; + } + FloatArrayF<4> giveRealStressVector_PlaneStrain( const FloatArrayF<4> &strain, GaussPoint *gp, TimeStep *tStep) const override + { + FloatArray answer; + const_cast(this)->giveRealStressVector(answer, gp, strain, tStep); + return answer; + } + FloatArray giveRealStressVector_StressControl(const FloatArray &strain, const IntArray &strainControl, GaussPoint *gp, TimeStep *tStep) const override + { + FloatArray answer; + const_cast(this)->giveRealStressVector(answer, gp, strain, tStep); + return answer; + } + FloatArrayF<3> giveRealStressVector_PlaneStress(const FloatArrayF<3> &strain, GaussPoint *gp, TimeStep *tStep) const override + { + FloatArray answer; + const_cast(this)->giveRealStressVector(answer, gp, strain, tStep); + return answer; + } + FloatArrayF<1> giveRealStressVector_1d(const FloatArrayF<1> &strain, GaussPoint *gp, TimeStep *tStep) const override + { + FloatArray answer; + const_cast(this)->giveRealStressVector(answer, gp, strain, tStep); + return answer; + } + + int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep) override; + + FloatArrayF<6> giveThermalDilatationVector(GaussPoint *gp, TimeStep *tStep) const override; + virtual double evaluatePermanentStrain(double kappa, double omega) const { return 0.; } + + /** + * Returns the value of material property 'aProperty'. Property must be identified + * by unique int id. Integration point also passed to allow for materials with spatially + * varying properties + * @param aProperty ID of property requested. + * @param gp Integration point, + * @return Property value. + */ + double give(int aProperty, GaussPoint *gp) const override; + /** + * Computes the equivalent strain measure from given strain vector (full form). + * @param[out] kappa Return parameter, containing the corresponding equivalent strain. + * @param strain Total strain vector in full form. + * @param gp Integration point. + * @param tStep Time step. + */ + virtual double computeEquivalentStrain(const FloatArray &strain, GaussPoint *gp, TimeStep *tStep) const = 0; + /**Computes derivative of the equivalent strain with regards to strain + * @param[out] answer Contains the resulting derivative. + * @param strain Strain vector. + * @param gp Integration point. + * @param tStep Time step. + */ + virtual void computeEta(FloatArray &answer, const FloatArray &strain, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("not implemented"); } + /** + * Computes the value of damage parameter omega, based on given value of equivalent strain. + * @param[out] omega Contains result. + * @param kappa Equivalent strain measure. + * @param strain Total strain in full form. + * @param gp Integration point. + */ + virtual double computeDamageParam(double kappa, const FloatArray &strain, GaussPoint *gp) const = 0; + + void initializeFrom(InputRecord &ir) override; + void giveInputRecord(DynamicInputRecord &input) override; + + MaterialStatus *CreateStatus(GaussPoint *gp) const override { return new IsotropicDamageMaterialStatus(gp); } + + FloatMatrixF<1,1> give1dStressStiffMtrx(MatResponseMode mmode, GaussPoint *gp, + TimeStep *tStep) const override; + + void saveContext(DataStream &stream, ContextMode mode) override; + void restoreContext(DataStream &stream, ContextMode mode) override; + + protected: + /** + * Abstract service allowing to perform some initialization, when damage first appear. + * @param kappa Scalar measure of strain level. + * @param totalStrainVector Current total strain vector. + * @param gp Integration point. + */ + virtual void initDamaged(double kappa, FloatArray &totalStrainVector, GaussPoint *gp) const { } + + /** + * Returns the value of derivative of damage function + * wrt damage-driving variable kappa corresponding + * to a given value of the kappa, depending on + * the type of selected damage law. + * @param kappa Equivalent strain measure. + * @param gp Integration point. + */ + virtual double damageFunctionPrime(double kappa, GaussPoint *gp) const { + OOFEM_ERROR("not implemented"); + return 0; + } + + FloatMatrixF<3,3> givePlaneStressStiffMtrx(MatResponseMode mmode, GaussPoint *gp,TimeStep *tStep) const override; + FloatMatrixF<4,4> givePlaneStrainStiffMtrx(MatResponseMode mmode, GaussPoint *gp, TimeStep *tStep) const override; + + }; + +Finally we present the implementation of the selected methods of `IsotropicDamageMaterial` class. +Let us start with the implementation of the `give3dMaterialStiffnessMatrix` method, which computes the 3D material stiffness, respecting the previous loading history described by state variable: + +.. code-block:: cpp + :linenos: + + FloatMatrixF<6,6> + IsotropicDamageMaterial :: give3dMaterialStiffnessMatrix(MatResponseMode mode, + GaussPoint *gp, + TimeStep *tStep) const + // + // computes full constitutive matrix for case of gp stress-strain state. + // + { + auto status = static_cast< IsotropicDamageMaterialStatus * >( this->giveStatus(gp) ); + double tempDamage; + if ( mode == ElasticStiffness ) { + tempDamage = 0.0; + } else { + tempDamage = status->giveTempDamage(); + tempDamage = min(tempDamage, maxOmega); + } + + auto d = this->linearElasticMaterial->give3dMaterialStiffnessMatrix(mode, gp, tStep); + return d * (1.0 - tempDamage); + //TODO - correction for tangent mode + } + +The `giveRealStressesVector` method computes the real stress +respecting the previous loading history (described by state variables) and the given strain vector. It computes +a new locally consistent (equilibrated) state, which is stored in temporary +variables of the corresponding status (attribute of the integration point). + +.. code-block:: cpp + :linenos: + + void + IsotropicDamageMaterial :: giveRealStressVector(FloatArray &answer, GaussPoint *gp, + const FloatArray &totalStrain, + TimeStep *tStep) + // + // returns real stress vector in 3d stress space of receiver according to + // previous level of stress and current + // strain increment, the only way, how to correctly update gp records + // + { + IsotropicDamageMaterialStatus *status = static_cast< IsotropicDamageMaterialStatus * >( this->giveStatus(gp) ); + LinearElasticMaterial *lmat = this->giveLinearElasticMaterial(); + FloatArray reducedTotalStrainVector; + FloatMatrix de; + double f, equivStrain, tempKappa = 0.0, omega = 0.0; + + this->initTempStatus(gp); + + // subtract stress-independent part + // note: eigenStrains (temperature) are present in strains stored in gp + // therefore it is necessary to subtract always the total eigen strain value + this->giveStressDependentPartOfStrainVector(reducedTotalStrainVector, gp, totalStrain, tStep, VM_Total); + + // compute equivalent strain + equivStrain = this->computeEquivalentStrain(reducedTotalStrainVector, gp, tStep); + + if ( llcriteria == idm_strainLevelCR ) { + // compute value of loading function if strainLevel crit apply + f = equivStrain - status->giveKappa(); + + if ( f <= 0.0 ) { + // damage does not grow + tempKappa = status->giveKappa(); + omega = status->giveDamage(); + } else { + // damage grows + tempKappa = equivStrain; + this->initDamaged(tempKappa, reducedTotalStrainVector, gp); + // evaluate damage parameter + omega = this->computeDamageParam(tempKappa, reducedTotalStrainVector, gp); + } + } else if ( llcriteria == idm_damageLevelCR ) { + // evaluate damage parameter first + tempKappa = equivStrain; + this->initDamaged(tempKappa, reducedTotalStrainVector, gp); + omega = this->computeDamageParam(tempKappa, reducedTotalStrainVector, gp); + if ( omega < status->giveDamage() ) { + // unloading takes place + omega = status->giveDamage(); + } + } else { + OOFEM_ERROR("unsupported loading/unloading criterion"); + } + + // get material stiffness from bulk material + lmat->giveStiffnessMatrix(de, SecantStiffness, gp, tStep); + + // damage deactivation in compression for 1D model + if ( ( reducedTotalStrainVector.giveSize() > 1 ) || ( reducedTotalStrainVector.at(1) > 0. ) ) { + //emj + de.times(1.0 - omega); + } + + answer.beProductOf(de, reducedTotalStrainVector); + + // update gp status + status->letTempStrainVectorBe(totalStrain); + status->letTempStressVectorBe(answer); + status->setTempKappa(tempKappa); + status->setTempDamage(omega); + } + + +The above general class provides the general framework. The derived +classes have to implement only services +`computeEquivalentStrain` and `computeDamageParam`, +which are only related to particular material model under consideration. +For full reference, please refer to the src/sm/Materials/isotropicdamagematerial.h and src/sm/Materials/isotropicdamagematerial.C files. + +For example of simple Isotropic Damage Model, please refer to the src/sm/Materials/ConcreteMaterials/idm1.h and src/sm/Materials/ConcreteMaterials/idm1.C files. + diff --git a/doc/developerGuide/utilityclasses.rst b/doc/developerGuide/utilityclasses.rst new file mode 100644 index 000000000..07bc148d3 --- /dev/null +++ b/doc/developerGuide/utilityclasses.rst @@ -0,0 +1,61 @@ +Utility classes +================ + +Vectors and Matrices +-------------------- + +The OOFEMlib provides the abstraction for integer vectors (`IntArray`) +and for real vectors and matrices (`FloatArray` and +`FloatMatrix` classes). The usual arithmetic operations (like vector and +matrix additions, subtractions, matrix vector multiplication, matrix +inverse, solution of linear system, finding eigenvalues and +eigenvectors) are provided. However, the usual math operators ('+','*') +are not overloaded, user has to call specific routines. +The vector and matrices provide both 0-based and 1-based component +access, they allow for dynamic resize with optional chunk. In fact, +the current implementation of `resize` only grows the +receiver, the possible request for shrink does not cause the +reallocation of memory, since allocated memory is kept for future possible resize. If +resize operation wants to force allocation, then `hardResize` method +should be invoked instead. +The preferred argument passing is by reference, even for function or +procedure return values. +The called function performs resize and fills up +the return parameter(s). This is motivated by aim to avoid memory +allocation/de-allocation problems. The programer should always avoid to +return pointers to newly allocated arrays or matrices. +See section `Coding Standards`_ for +details. + +Solution steps +-------------- +The class representing solution step is `TimeStep`. It may represent either +time step, load increment, or load case depending on current Engineering model used. + +Solution step maintain the reference to corresponding Engineering model class instance. +It maintain also its "intrinsic time" and corresponding time increment. The meaning of these +values is dependent on current Engineering model used. The time may represent either +current time, load increment number or load case number. See corresponding +EngngModel reference for details. + +Some components (typically integration points real stresses or integration points non-local values) +are computationally very demanding. Because in typical code, there are number of requests for same value +during the computation process, it may be efficient to store these values and compute them only once. +The principal problem is to recognize, when is necessary to re-compute these stored values to reflect +newly reached state. This cannot be determined form solution step "time", because solution step may +represent for example load increment, inside which typically many iterations are needed to reach +convergence. For this purpose, a concept of solution state counters is provided. +Whenever the solution state changes, the engineering model updates the solution state counter. +The solution state counter is guaranteed to grow up smoothly (it newer decreases) during solution process. +Other components of program (integration points) can then store their computationally expensive values +but have to store also corresponding solution state counter value valid when these were computed. +Then their can easily check for difference between freezed solution state counter for their value with +current solution state requested from solution step and recompute the values if necessary. + +Load Time Functions +------------------- +Abstract base class representing load time function. Classes derived from Load class typically +describe load from spatial point of view. The purpose of introducing load time function is to express +variation of some components in time. Load time function typically belongs to domain and is +attribute of one or more loads. Generally load time function is real function of time (:math:`y=f(t)`). + diff --git a/doc/developerGuide/xfem.rst b/doc/developerGuide/xfem.rst new file mode 100644 index 000000000..733a1ba84 --- /dev/null +++ b/doc/developerGuide/xfem.rst @@ -0,0 +1,101 @@ +XFEM module +================ + +An entity subject to XFEM modeling is described by an `EnrichmentItem`. +Such an entity can be e.g. a crack or a material interface. The +`EnrichmentItem` is responsible for the geometrical description as well as +the enrichment functions. The `EnrichmentItem` is also responsible for the +necessary updates if the interface is moving (e.g. if a crack is propagating). +The `EnrichmentItem` has different data members to fulfill these +requirements: + +- The `EnrichmentItem`has an `EnrichmentDomain` that is + responsible for the geometrical description. The `EnrichmentDomain` can be e.g. a + polygon line or a list of node numbers. +- The `EnrichmentItem` has an `EnrichmentFunction` that + describes the enrichment along the crack or interface. +- The `EnrichmentItem` has an `EnrichmentFront` that specifies + a special treatment of the ends of the interface if desired. It may e.g. apply + branch functions within a specified radius around the crack tips. +- The `EnrichmentItem` has a `PropagationLaw` that describes + how the interface evolves in time. It may e.g. propagate a crack in a specified + direction. + + + +The enrichment functions are represented by classes derived from the pure +virtual `EnrichmentFunction` class. In particular, the following methods +have to be overloaded by all subclasses of `EnrichmentFunction`: + +- `evaluateEnrFuncAt`: Computes the value of the enrichment + function in a given point for a given level set value. +- `evaluateEnrFuncDerivAt`: Computes the gradient of the enrichment + function in a given point for a given level set value. +- `giveJump`: Returns the jump of the enrichment function when the + level set field changes sign, e.g. 1 for Heaviside, 2 for Sign and 0 for abs + enrichment. This method is needed for a generic implementation of cohesive + zones. + + +The enrichment items are stored in an array in the `XfemManager` +class, that also provides initialization and access to individual +enrichment items. The purpose of the `XfemManager` is to encapsulate XFEM +specific functionality. This avoids to a certain extent the need to modify and +penetrate the original code. + +When a certain node in the problem domain is subjected to enrichment, the +corresponding enrichment item has to introduce additional degree(s) of freedom +in that node. Since several enrichment items can be active in a node, all DOFs +are assigned with a label, that allows to distinguish between them (in +traditional FE codes labels are also used to distinguish physical meaning of +particular DOF representing displacement along x,y,z axes, rotations, etc.). +The `XfemManager` class maintains a pool of available labels and is +responsible for their assignment to individual enrichment items. + +Each enrichment item keeps its assigned DOF labels (provided by `XfemManager`). +These are used by individual enrichment items to introduce and later identify +related DOFs in individual nodes. The physical meaning of these DOFs depends on +the enrichment item. For example, a single DOF is needed to represent slip along +a slip line and two DOFs are required for a displacement discontinuity in 2D +modeled with Heaviside enrichment. + + +If the enrichment items evolve in time, the geometrical description needs to be +updated and new enriched DOFs may need to be created. This is done by the +`updateGeometry` method in the `XfemManager` class. The +sub-triangulation of cut elements may have to be updated as a result of the +geometrical update (e.g. previously uncut elements may be cut by a crack and +therefore need to be subdivided). The solver class `XFEMStatic` handles +this problem by creating a new domain with a new sub-triangulation and mapping +state variables as well as primary variables from the old domain to the new +domain. + + +The sub-triangulation of cut elements as well as computation of B-matrices for +2D XFEM elements are to a large extent encapsulated in the +`XfemElementInterface` class. Methods needed for cohesive zones are also +implemented here. The 2D elements with XFEM functionality are therefore derived +from the standard `Element` base class, as well as from the +`XfemElementInterface`. + +When a cut element has been subdivided by the `XfemElementInterface`, +a `PatchIntegrationRule` class is used to represent the integration scheme, +where Gauss integration is employed on individual triangles. When +initializing the integration points, their local coordinates (related to the +triangle geometry) are mapped into parent element coordinates and the +corresponding integration weights are scaled accordingly. There is no need to +store individual patch geometries, as the parent element geometry is used to +correctly evaluate transformation Jacobians (we may however wish to store the +them for debugging or visualization). + +If a cohesive crack model is employed, additional integration points along +the discontinuity are needed. These are stored separately, see +`XfemElementInterface` class. + +The following test cases involve the XFEM module: + +- sm/xFemCrackVal.in +- sm/xFemCrackValBranch.in +- sm/xfemCohesiveZone1.in +- benchmark/xfem01.in +- sm/plasticRemap1.in diff --git a/doc/elementlibmanual/elementlibmanual.tex b/doc/elementlibmanual/elementlibmanual.tex index 54233102d..c4a6ac999 100644 --- a/doc/elementlibmanual/elementlibmanual.tex +++ b/doc/elementlibmanual/elementlibmanual.tex @@ -1176,7 +1176,9 @@ \subsubsection{L4axisymm element} %----------------------------------------------------------------------------------------------- \clearpage -\subsection{3d Continuum Elements} +\subsection{3D Continuum Elements} +This section contains description of continuum elements. + \subsubsection{LSpace element} \label{lspacesect} Implementation of Linear 3d eight - node @@ -1195,7 +1197,7 @@ \subsubsection{LSpace element} \elementDescription{Unknowns}{Three dofs (u-displacement, v-displacement, w-displacement) are required in each node.} \elementDescription{Approximation}{Linear approximation of displacement and geometry.} \elementDescription{Integration}{Full integration of all strain components.} -\elementDescription{Features}{Adaptivity support, Geometric nonlinearity support.} +\elementDescription{Features}{Supports adaptivity, geometric nonlinearity, and layered cross section support } \elementDescription{CS properties}{-} \elementDescription{Loads}{-} \elementDescription{Nlgeo}{0,1,2.} @@ -1226,7 +1228,7 @@ \subsubsection{QSpace element}\label{QSpace_element} \elementDescription{Unknowns}{Three dofs (u-displacement, v-displacement, w-displacement) are required in each node.} \elementDescription{Approximation}{Quadratic approximation of displacement and geometry.} \elementDescription{Integration}{Full integration of all strain components.} -\elementDescription{Features}{-} +\elementDescription{Features}{Layered cross section support.} \elementDescription{CS properties}{-} \elementDescription{Loads}{-} \elementDescription{Nlgeo}{0,1,2.} @@ -1313,7 +1315,7 @@ \subsubsection{LWedge element} \elementDescription{Unknowns}{Three dofs (u-displacement, v-displacement, w-displacement) are required in each node.} \elementDescription{Approximation}{Linear approximation of displacements and geometry.} \elementDescription{Integration}{Full integration of all strain components using four point Gauss integration formula.} -\elementDescription{Features}{-} +\elementDescription{Features}{Layered cross section support.} \elementDescription{CS properties}{-} \elementDescription{Loads}{-} \elementDescription{Nlgeo}{0,1,2.} @@ -1340,13 +1342,41 @@ \subsubsection{QWedge element} \elementDescription{Unknowns}{Three dofs (u-displacement, v-displacement, w-displacement) are required in each node.} \elementDescription{Approximation}{Quadratic approximation of displacements and geometry.} \elementDescription{Integration}{Full integration of all strain components using four point Gauss integration formula.} -\elementDescription{Features}{-} +\elementDescription{Features}{Layered cross section support.} \elementDescription{CS properties}{-} \elementDescription{Loads}{-} \elementDescription{Nlgeo}{0,1,2.} \elementDescription{Status}{Reliable} \end{elementsummary} +\subsubsection{Layer stacking sequence definition for 3D elements} +Selected 3D elements (bricks and wedge geometries) support using the LayeredCrossSection model to define layer stack as a sequence of individual layers. +Individual layers are assumed to lie in element parametric $\xi-\eta$ plane and are stacked along parametric $\zeta$ coordinate of the element. The direction of parametric coordinates is determined by element node numbering convention, see figures with element geometries above. +Note, that the stacking direction is in general the function of element geometry. + +It is important to understand concept of element and material coordinate systems. + +The element coordinate system (elemCS) coincides, by default, with the global coordinate system. +The user-defined element coordinate system can be defined using lcs parameter. +The lcs parameter defines an array of size 6, where the first 3 components define direction of +local element-axis and remaining 3 components define direction of local element y-axis. +The local element z axis is computed using vector product $e_z=e_x\times e_y$. + +The material properties of each layer are defined in material coordinate system (matCS). +Also the solver output for individual layers is done in matCS. +By default, the material coordinate system coincides with global coordinate system. +Additionally, the material coordinate system for individual layer can be rotated around material CS z-axis by angle, defined by layered cross section \param{rotations} keyword. This array parameter allows to define rotation angle for individual layers and should be defined in degrees not radians. +If \param{matcs} element keyword is present, but no lcs element record is defined, then the following definition of elemCS is assumed: +$e_x=\{\frac{dx(\xi,\eta,\zeta)}{d\xi},\frac{dy(\xi,\eta,\zeta)}{d\xi},\frac{dz(\xi,\eta,\zeta)}{d\xi}\}, +h=\{\frac{dx(\xi,\eta,\zeta)}{d\eta},\frac{dy(\xi,\eta,\zeta)}{d\eta},\frac{dz(\xi,\eta,\zeta)}{d\eta}\}, +e_z=e_x\times h, e_y=e_z\times e_x$, +where $\xi,\eta,\zeta$ are parametric element coordinates. +The strains and stresses in individual layers are always reported in material coordinate system. +LayeredCS integration +The layered cross section integration can be set up using number of integrations points in +layer plane (\param{nintegrationpoints} parameter ) and using number of integration points per layer + thickness (\param{layerintegrationpoints} parameter). + %----------------------------------------------------------------------------------------------- \clearpage \subsection{Interface elements} diff --git a/doc/makefile b/doc/makefile index f9ff4c737..e41fb4e4f 100644 --- a/doc/makefile +++ b/doc/makefile @@ -7,7 +7,7 @@ html: cd paper-actap; make html cd extractorInput; make html cd matlibmanual; make html - cd programmer; make html + cd developperGuide; make html cd refman; make html cd theorymanual; make html cd usermanual; make html @@ -17,7 +17,6 @@ ps: cd paper-actap; make ps cd extractorInput; make ps cd matlibmanual; make ps - cd programmer; make ps cd theorymanual; make ps pdf: @@ -26,7 +25,7 @@ pdf: cd paper-actap; make pdf cd extractorInput; make pdf cd matlibmanual; make pdf - cd programmer; make pdf + cd developperGuide; make latexpdf cd theorymanual; make pdf cd usermanual; make latexpdf @@ -38,7 +37,7 @@ ifdef INSTALLDIR cd paper-actap; make www-install cd extractorInput; make www-install cd matlibmanual; make www-install - cd programmer; make www-install + cd developperGuide; make www-install cd refman; make www-install cd theorymanual; make www-install cd usermanual; make www-install @@ -53,6 +52,6 @@ clean: cd paper-actap; make clean cd extractorInput; make clean cd matlibmanual; make clean - cd programmer; make clean + cd developperGuide; make clean cd refman; make clean cd theorymanual; make clean diff --git a/doc/programmer/acta1.sty b/doc/obsolete/programmer/acta1.sty similarity index 100% rename from doc/programmer/acta1.sty rename to doc/obsolete/programmer/acta1.sty diff --git a/doc/programmer/auto/programmer.el b/doc/obsolete/programmer/auto/programmer.el similarity index 100% rename from doc/programmer/auto/programmer.el rename to doc/obsolete/programmer/auto/programmer.el diff --git a/doc/programmer/auto/usrman.el b/doc/obsolete/programmer/auto/usrman.el similarity index 100% rename from doc/programmer/auto/usrman.el rename to doc/obsolete/programmer/auto/usrman.el diff --git a/doc/programmer/class_BsplinePlaneStressElement_collaboration.eps b/doc/obsolete/programmer/class_BsplinePlaneStressElement_collaboration.eps similarity index 100% rename from doc/programmer/class_BsplinePlaneStressElement_collaboration.eps rename to doc/obsolete/programmer/class_BsplinePlaneStressElement_collaboration.eps diff --git a/doc/programmer/class_BsplinePlaneStressElement_collaboration.fig b/doc/obsolete/programmer/class_BsplinePlaneStressElement_collaboration.fig similarity index 100% rename from doc/programmer/class_BsplinePlaneStressElement_collaboration.fig rename to doc/obsolete/programmer/class_BsplinePlaneStressElement_collaboration.fig diff --git a/doc/programmer/class_BsplinePlaneStressElement_collaboration.pdf b/doc/obsolete/programmer/class_BsplinePlaneStressElement_collaboration.pdf similarity index 100% rename from doc/programmer/class_BsplinePlaneStressElement_collaboration.pdf rename to doc/obsolete/programmer/class_BsplinePlaneStressElement_collaboration.pdf diff --git a/doc/programmer/class_IGA__IntegrationElement_mod.eps b/doc/obsolete/programmer/class_IGA__IntegrationElement_mod.eps similarity index 100% rename from doc/programmer/class_IGA__IntegrationElement_mod.eps rename to doc/obsolete/programmer/class_IGA__IntegrationElement_mod.eps diff --git a/doc/programmer/class_IGA__IntegrationElement_mod.fig b/doc/obsolete/programmer/class_IGA__IntegrationElement_mod.fig similarity index 100% rename from doc/programmer/class_IGA__IntegrationElement_mod.fig rename to doc/obsolete/programmer/class_IGA__IntegrationElement_mod.fig diff --git a/doc/programmer/class_IGA__IntegrationElement_mod.pdf b/doc/obsolete/programmer/class_IGA__IntegrationElement_mod.pdf similarity index 100% rename from doc/programmer/class_IGA__IntegrationElement_mod.pdf rename to doc/obsolete/programmer/class_IGA__IntegrationElement_mod.pdf diff --git a/doc/programmer/coyo.eps b/doc/obsolete/programmer/coyo.eps similarity index 100% rename from doc/programmer/coyo.eps rename to doc/obsolete/programmer/coyo.eps diff --git a/doc/programmer/coyo.pdf b/doc/obsolete/programmer/coyo.pdf similarity index 100% rename from doc/programmer/coyo.pdf rename to doc/obsolete/programmer/coyo.pdf diff --git a/doc/programmer/engng.eps b/doc/obsolete/programmer/engng.eps similarity index 100% rename from doc/programmer/engng.eps rename to doc/obsolete/programmer/engng.eps diff --git a/doc/programmer/engng.pdf b/doc/obsolete/programmer/engng.pdf similarity index 100% rename from doc/programmer/engng.pdf rename to doc/obsolete/programmer/engng.pdf diff --git a/doc/programmer/enrichmentitem_collab.eps b/doc/obsolete/programmer/enrichmentitem_collab.eps similarity index 100% rename from doc/programmer/enrichmentitem_collab.eps rename to doc/obsolete/programmer/enrichmentitem_collab.eps diff --git a/doc/programmer/enrichmentitem_collab.fig b/doc/obsolete/programmer/enrichmentitem_collab.fig similarity index 100% rename from doc/programmer/enrichmentitem_collab.fig rename to doc/obsolete/programmer/enrichmentitem_collab.fig diff --git a/doc/programmer/enrichmentitem_collab.pdf b/doc/obsolete/programmer/enrichmentitem_collab.pdf similarity index 100% rename from doc/programmer/enrichmentitem_collab.pdf rename to doc/obsolete/programmer/enrichmentitem_collab.pdf diff --git a/doc/programmer/general.eps b/doc/obsolete/programmer/general.eps similarity index 100% rename from doc/programmer/general.eps rename to doc/obsolete/programmer/general.eps diff --git a/doc/programmer/general.pdf b/doc/obsolete/programmer/general.pdf similarity index 100% rename from doc/programmer/general.pdf rename to doc/obsolete/programmer/general.pdf diff --git a/doc/programmer/general.ps b/doc/obsolete/programmer/general.ps similarity index 100% rename from doc/programmer/general.ps rename to doc/obsolete/programmer/general.ps diff --git a/doc/programmer/include.src.tex b/doc/obsolete/programmer/include.src.tex similarity index 100% rename from doc/programmer/include.src.tex rename to doc/obsolete/programmer/include.src.tex diff --git a/doc/programmer/include.tex b/doc/obsolete/programmer/include.tex similarity index 100% rename from doc/programmer/include.tex rename to doc/obsolete/programmer/include.tex diff --git a/doc/programmer/integrationrule_collab.eps b/doc/obsolete/programmer/integrationrule_collab.eps similarity index 100% rename from doc/programmer/integrationrule_collab.eps rename to doc/obsolete/programmer/integrationrule_collab.eps diff --git a/doc/programmer/integrationrule_collab.fig b/doc/obsolete/programmer/integrationrule_collab.fig similarity index 100% rename from doc/programmer/integrationrule_collab.fig rename to doc/obsolete/programmer/integrationrule_collab.fig diff --git a/doc/programmer/integrationrule_collab.pdf b/doc/obsolete/programmer/integrationrule_collab.pdf similarity index 100% rename from doc/programmer/integrationrule_collab.pdf rename to doc/obsolete/programmer/integrationrule_collab.pdf diff --git a/doc/programmer/latex2html-init.shtml b/doc/obsolete/programmer/latex2html-init.shtml similarity index 100% rename from doc/programmer/latex2html-init.shtml rename to doc/obsolete/programmer/latex2html-init.shtml diff --git a/doc/programmer/makefile b/doc/obsolete/programmer/makefile similarity index 100% rename from doc/programmer/makefile rename to doc/obsolete/programmer/makefile diff --git a/doc/programmer/microp.eps b/doc/obsolete/programmer/microp.eps similarity index 100% rename from doc/programmer/microp.eps rename to doc/obsolete/programmer/microp.eps diff --git a/doc/programmer/microp.pdf b/doc/obsolete/programmer/microp.pdf similarity index 100% rename from doc/programmer/microp.pdf rename to doc/obsolete/programmer/microp.pdf diff --git a/doc/programmer/oofem-logo-contour.eps b/doc/obsolete/programmer/oofem-logo-contour.eps similarity index 100% rename from doc/programmer/oofem-logo-contour.eps rename to doc/obsolete/programmer/oofem-logo-contour.eps diff --git a/doc/programmer/oofem-logo-contour.pdf b/doc/obsolete/programmer/oofem-logo-contour.pdf similarity index 100% rename from doc/programmer/oofem-logo-contour.pdf rename to doc/obsolete/programmer/oofem-logo-contour.pdf diff --git a/doc/programmer/programmer.tex b/doc/obsolete/programmer/programmer.tex similarity index 99% rename from doc/programmer/programmer.tex rename to doc/obsolete/programmer/programmer.tex index acadbc159..db7b4d6d3 100644 --- a/doc/programmer/programmer.tex +++ b/doc/obsolete/programmer/programmer.tex @@ -1096,7 +1096,7 @@ \subsection{Problem representation - Engineering model} int nelem = domain->giveNumberOfElements (); for (j=1 ; j<=nelem ; j++) { elem = domain -> giveElement(j) ; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE // skip remote elements (these are used as mirrors // of remote elements on other domains, when nonlocal // constitutive models are used. @@ -1172,7 +1172,7 @@ \subsection{Problem representation - Engineering model} int nelem = domain -> giveNumberOfElements (); for ( ielem = 1; ielem <= nelem ; ielem++ ) { element = domain -> giveElement(ielem); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE // skip remote elements (these are used as mirrors of remote eleemnts on other domains // when nonlocal constitutive models are used. They introduction is necessary to // allow local averaging on domains without fine grain communication between domains). @@ -1238,7 +1238,7 @@ \subsection{Problem representation - Engineering model} for (i = 1; i <= nelem ; i++ ) { element = domain -> giveElement(i); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE // skip remote elements (these are used as mirrors of remote eleemnts on other domains // when nonlocal constitutive models are used. They introduction is necessary to // allow local averaging on domains without fine grain communication between domains). @@ -1298,7 +1298,7 @@ \subsection{Problem representation - Engineering model} for (i = 1; i <= nelem ; i++ ) { element = domain -> giveElement(i); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE // skip remote elements (these are used as mirrors of remote eleemnts on other domains // when nonlocal constitutive models are used. They introduction is necessary to // allow local averaging on domains without fine grain communication between domains). @@ -1619,7 +1619,7 @@ \subsection{Example - Linear Static Analysis} const char* giveClassName () const { return "LinearStatic";} classType giveClassID () const { return LinearStaticClass;} fMode giveFormulation () { return TL; } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE /** Determines the space necessary for send/receive buffer. It uses related communication map pattern to determine the maximum size needed. diff --git a/doc/programmer/struct1.eps b/doc/obsolete/programmer/struct1.eps similarity index 100% rename from doc/programmer/struct1.eps rename to doc/obsolete/programmer/struct1.eps diff --git a/doc/programmer/struct1.pdf b/doc/obsolete/programmer/struct1.pdf similarity index 100% rename from doc/programmer/struct1.pdf rename to doc/obsolete/programmer/struct1.pdf diff --git a/doc/programmer/struct2.eps b/doc/obsolete/programmer/struct2.eps similarity index 100% rename from doc/programmer/struct2.eps rename to doc/obsolete/programmer/struct2.eps diff --git a/doc/programmer/struct2.pdf b/doc/obsolete/programmer/struct2.pdf similarity index 100% rename from doc/programmer/struct2.pdf rename to doc/obsolete/programmer/struct2.pdf diff --git a/doc/oofemInput/apendices.rst b/doc/oofemInput/apendices.rst index 3e93ccc63..f6fe72cd7 100644 --- a/doc/oofemInput/apendices.rst +++ b/doc/oofemInput/apendices.rst @@ -413,9 +413,9 @@ Currently, the only supported initialization module is element number and the Gauss point number, in agreement with the mesh specified in later sections. - |- Each line referring to a Gauss point should contain the following data: - ``elnum #(in)`` ``gpnum #(in)`` ``coords #(ra)`` - ``ng #(in)`` ``var_1_id #(in)`` ``values_1 #(ra)`` ``...`` ``var_ng_id #(in)`` ``values_ng #(ra)`` + | - Each line referring to a Gauss point should contain the following data: + | ``elnum #(in)`` ``gpnum #(in)`` ``coords #(ra)`` + | ``ng #(in)`` ``var_1_id #(in)`` ``values_1 #(ra)`` ``...`` ``var_ng_id #(in)`` ``values_ng #(ra)`` - ``elnum`` is the element number @@ -434,7 +434,7 @@ Currently, the only supported initialization module is - ``values_ng`` are the values of variables in group number ng - - | Example: + | - Example: | ``37 4 3 0.02 0.04 0.05 3 52 1 0.23 62 1 0.049 1 6 0 -2.08e+07 0 0 0 0`` means that Gauss point number 4 of element number 37 has coordinates :math:`x=0.02`, :math:`y=0.04` and :math:`z=0.05` @@ -496,7 +496,7 @@ Optional parameter ``timeScale`` scales time in output. In transport problem, ba Currently, the supported export modules are following -- VTK export, **DEPRECATED - Use VTKXML** +- VTK export, **DEPRECATED - Use VTKXML or vtkhdf5 ** ``vtk`` [``vars #(ia)``] [``primvars #(ia)``] [``cellvars #(ia)``] [``stype #(in)``] [``regionstoskip #(ia)``] @@ -504,9 +504,19 @@ Currently, the supported export modules are following ``vtkxml`` [``vars #(ia)``] [``primvars #(ia)``] [``cellvars #(ia)``] [``ipvars #(ia)``] [``stype #(in)``] - - The vtk module is obsolete, use vtkxml instead. Vtkxml allows to + | <``ver 1.6``> + | ``vtkhdf5`` [``vars #(ia)``] [``primvars #(ia)``] [``cellvars #(ia)``] + [``ipvars #(ia)``] [``stype #(in)``] + + - The vtk module is obsolete, use vtkxml or vtkhdf5 instead. Vtkxml allows to export results recovered on region by region basis and has more - features. + features. The vtkxml export module exports result into vtu files, one file for each solution step (vtk ustructured grids). + The vtkhdf5 export module exports results into vtk hdf5 file (single hdf file fro all time steps). + Both output formats can be visualized using Paraview. + + The vtkhdf5 export module requires HDF5 library and oofem has to be configured with USE_HDF5=ON. + The HDF5 library version 1.14 (or later) is recommended. + - The array ``vars`` contains identifiers for those internal variables which are to be exported. These variables will be @@ -660,3 +670,54 @@ Currently, the supported export modules are following corresponding variable. This can be exploited e.g. to evaluate the total dissipated energy over the entire domain. +- Solution status monitor <``ver 1.6``> + | The Solution status monitor creates a report on problem solution. Its content is configurable, see below. + | The syntax of solutionstatus export module is following: + | ``solutionstatus`` [``fmt #(s)``] + | + | The fmt parameter allows to control what will be reported for each solution step. The fmt string contains data codes separated by colon. + | The following data codes are supported: + ++-----------+--------------------------------------------------------------------------+ +| Data code | Description | ++===========+==========================================================================+ +|m | Meta step number | ++-----------+--------------------------------------------------------------------------+ +|s | Solution step number | ++-----------+--------------------------------------------------------------------------+ +|a | Attempt number | ++-----------+--------------------------------------------------------------------------+ +|nite | Number of iterations | ++-----------+--------------------------------------------------------------------------+ +|t | Solution step target time | ++-----------+--------------------------------------------------------------------------+ +|dt | Solution step time increment | ++-----------+--------------------------------------------------------------------------+ +|st | Time spend on solving solution step [s] | ++-----------+--------------------------------------------------------------------------+ +|cr | | Convergence reason status | +| | | - *Converged* | +| | | - *Diverged_I* (Convergence not reached with maximum iteration limit) | +| | | - *Diverged_T* (Diverged solution) | +| | | - *Failed* | ++-----------+--------------------------------------------------------------------------+ +|\- | Placeholder, will print ‘-‘ | ++-----------+--------------------------------------------------------------------------+ + + | The default fmt string is "m:s:a:nite:t:dt:st:cr" + | Example of input record: + | ``solutionstatus`` ``tstep_all`` ``fmt m:s:a:nite:t:dt:st:cr`` + +- Error checking module + Error checking rule used for regressions tests. It compares the user-selected computed results with the reference results. + The individual rules are defined in a separate section with dedicated syntax, that can be part of the input file itself, or defined in external file. + Their syntax follows the syntax of Extractor package, namely its `Value records section `_. + + The syntax of the error checking module is following: + + ``errorcheck`` [``filename #(s)``] [``extract``] + + By default the module performs the regression tests and issues the error when one or more tests fail. + The module can also be used to extract user-selected quantities rather than testing them against expected values. This can be done by adding ``extract`` keyword to the input record of the module. + The ``filename`` parameter allows to specify filename (with path) in which the rules are defined, insted of input file itself (the default). + diff --git a/doc/oofemInput/introduction.rst b/doc/oofemInput/introduction.rst index 78baf4d66..727669355 100644 --- a/doc/oofemInput/introduction.rst +++ b/doc/oofemInput/introduction.rst @@ -222,7 +222,7 @@ attribute values are following: | The general format of record is | [``attribute1_keyword #(type)``] ``...`` - [``attributeXX_keyword #(type)``] + [``attributeXX_keyword #(type)``] <``ver. 1.6``> The keywords and their values are separated by one or more spaces. Please note, that a single record cooresponds to one input line in input @@ -231,7 +231,7 @@ file. When some attribute is enclosed in brackets [ ], then it’s use is optional and often overwrites the default behavior or adds additional (but optional) information or property (for example adds a loading to -node). +node). The angle brackets < > are used to indicate the solver version requirements. | Example of input record. | As an example, consider the following record description: diff --git a/doc/refman/doxygen.cfg b/doc/refman/doxygen.cfg index 090bef9cc..552a11450 100644 --- a/doc/refman/doxygen.cfg +++ b/doc/refman/doxygen.cfg @@ -2044,7 +2044,7 @@ INCLUDE_FILE_PATTERNS = # recursively expanded use the := operator instead of the = operator. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -PREDEFINED = __PARALLEL_MODE \ +PREDEFINED = __MPI_PARALLEL_MODE \ __USE_MPI \ __FM_MODULE \ __SM_MODULE \ diff --git a/doc/refman/doxygen.cfg.in b/doc/refman/doxygen.cfg.in index 79fa437e7..c88af84c0 100644 --- a/doc/refman/doxygen.cfg.in +++ b/doc/refman/doxygen.cfg.in @@ -262,7 +262,7 @@ INCLUDE_FILE_PATTERNS = # undefined via #undef or recursively expanded use the := operator # instead of the = operator. -PREDEFINED = __PARALLEL_MODE \ +PREDEFINED = __MPI_PARALLEL_MODE \ __USE_MPI \ __FM_MODULE \ __SM_MODULE \ diff --git a/extern/pybind11 b/extern/pybind11 index 01ab93561..ffa346860 160000 --- a/extern/pybind11 +++ b/extern/pybind11 @@ -1 +1 @@ -Subproject commit 01ab935612a6800c4ad42957808d6cbd30047902 +Subproject commit ffa346860b306c9bbfb341aed9c14c067751feb8 diff --git a/oofem_Build/.cmake/api/v1/query/client-MicrosoftVS/query.json b/oofem_Build/.cmake/api/v1/query/client-MicrosoftVS/query.json new file mode 100644 index 000000000..7d776af01 --- /dev/null +++ b/oofem_Build/.cmake/api/v1/query/client-MicrosoftVS/query.json @@ -0,0 +1 @@ +{"requests":[{"kind":"cache","version":2},{"kind":"cmakeFiles","version":1},{"kind":"codemodel","version":2},{"kind":"toolchains","version":1}]} \ No newline at end of file diff --git a/oofem_Build/CMakeCache.txt b/oofem_Build/CMakeCache.txt new file mode 100644 index 000000000..c0b5edda4 --- /dev/null +++ b/oofem_Build/CMakeCache.txt @@ -0,0 +1,107 @@ +# This is the CMakeCache file. +# For build in directory: c:/Users/CMourlas001/source/repos/oofem/oofem_Build +# It was generated by CMake: C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin/cmake.exe +# You can edit this file to change values found and used by cmake. +# If you do not want to change any of the values, simply exit the editor. +# If you do want to change a value, simply edit, save, and exit the editor. +# The syntax for the file is as follows: +# KEY:TYPE=VALUE +# KEY is the name of a variable in the cache. +# TYPE is a hint to GUIs for the type of VALUE, DO NOT EDIT TYPE!. +# VALUE is the current value for the KEY. + +######################## +# EXTERNAL cache entries +######################## + +//Path to a program. +CCACHE_PROGRAM:FILEPATH=CCACHE_PROGRAM-NOTFOUND + +//No help, variable specified on the command line. +CMAKE_BUILD_TYPE:STRING=Debug + +//No help, variable specified on the command line. +CMAKE_CXX_COMPILER:FILEPATH=C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.41.34120/bin/Hostx64/x64/cl.exe + +//No help, variable specified on the command line. +CMAKE_C_COMPILER:FILEPATH=C:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.41.34120/bin/Hostx64/x64/cl.exe + +//Value Computed by CMake. +CMAKE_FIND_PACKAGE_REDIRECTS_DIR:STATIC=C:/Users/CMourlas001/source/repos/oofem/oofem_Build/CMakeFiles/pkgRedirects + +//No help, variable specified on the command line. +CMAKE_INSTALL_PREFIX:PATH=C:/Users/CMourlas001/Source/Repos/oofem/oofem + +//make program +CMAKE_MAKE_PROGRAM:FILEPATH=C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/Ninja/ninja.exe + +//Value Computed by CMake +CMAKE_PROJECT_DESCRIPTION:STATIC= + +//Value Computed by CMake +CMAKE_PROJECT_HOMEPAGE_URL:STATIC= + +//Value Computed by CMake +CMAKE_PROJECT_NAME:STATIC=oofem + +//No help, variable specified on the command line. +CMAKE_TOOLCHAIN_FILE:FILEPATH=C:/Users/CMourlas001/Source/Repos/oofem/oofem_Build + +//Git command line client +GIT_EXECUTABLE:FILEPATH=C:/Users/CMourlas001/AppData/Local/Programs/Git/cmd/git.exe + +//No help, variable specified on the command line. +USE_DSS:BOOL=True + +//Value Computed by CMake +oofem_BINARY_DIR:STATIC=C:/Users/CMourlas001/source/repos/oofem/oofem_Build + +//Value Computed by CMake +oofem_IS_TOP_LEVEL:STATIC=ON + +//Value Computed by CMake +oofem_SOURCE_DIR:STATIC=C:/Users/CMourlas001/source/repos/oofem + + +######################## +# INTERNAL cache entries +######################## + +//This is the directory where this CMakeCache.txt was created +CMAKE_CACHEFILE_DIR:INTERNAL=c:/Users/CMourlas001/source/repos/oofem/oofem_Build +//Major version of cmake used to create the current loaded cache +CMAKE_CACHE_MAJOR_VERSION:INTERNAL=3 +//Minor version of cmake used to create the current loaded cache +CMAKE_CACHE_MINOR_VERSION:INTERNAL=29 +//Patch version of cmake used to create the current loaded cache +CMAKE_CACHE_PATCH_VERSION:INTERNAL=5 +//Path to CMake executable. +CMAKE_COMMAND:INTERNAL=C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin/cmake.exe +//Path to cpack program executable. +CMAKE_CPACK_COMMAND:INTERNAL=C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin/cpack.exe +//Path to ctest program executable. +CMAKE_CTEST_COMMAND:INTERNAL=C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin/ctest.exe +//Name of external makefile project generator. +CMAKE_EXTRA_GENERATOR:INTERNAL= +//Name of generator. +CMAKE_GENERATOR:INTERNAL=Ninja +//Generator instance identifier. +CMAKE_GENERATOR_INSTANCE:INTERNAL= +//Name of generator platform. +CMAKE_GENERATOR_PLATFORM:INTERNAL= +//Name of generator toolset. +CMAKE_GENERATOR_TOOLSET:INTERNAL= +//Source directory with the top level CMakeLists.txt file for this +// project +CMAKE_HOME_DIRECTORY:INTERNAL=C:/Users/CMourlas001/source/repos/oofem +//number of local generators +CMAKE_NUMBER_OF_MAKEFILES:INTERNAL=1 +//Platform information initialized +CMAKE_PLATFORM_INFO_INITIALIZED:INTERNAL=1 +//Path to CMake installation. +CMAKE_ROOT:INTERNAL=C:/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/share/cmake-3.29 +//Details about finding Git +FIND_PACKAGE_MESSAGE_DETAILS_Git:INTERNAL=[C:/Users/CMourlas001/AppData/Local/Programs/Git/cmd/git.exe][v2.45.1.windows.1()] +//ADVANCED property for variable: GIT_EXECUTABLE +GIT_EXECUTABLE-ADVANCED:INTERNAL=1 + diff --git a/oofem_Build/CMakeFiles/cmake.check_cache b/oofem_Build/CMakeFiles/cmake.check_cache new file mode 100644 index 000000000..3dccd7317 --- /dev/null +++ b/oofem_Build/CMakeFiles/cmake.check_cache @@ -0,0 +1 @@ +# This file is generated by cmake for dependency checking of the CMakeCache.txt file diff --git a/oofem_Build/VSInheritEnvironments.txt b/oofem_Build/VSInheritEnvironments.txt new file mode 100644 index 000000000..f8cc9d8ac --- /dev/null +++ b/oofem_Build/VSInheritEnvironments.txt @@ -0,0 +1 @@ +msvc_x64_x64 \ No newline at end of file diff --git a/src/GenerateVersionHeader.cmake b/src/GenerateVersionHeader.cmake index 1998d7ef5..bd9e5aa31 100644 --- a/src/GenerateVersionHeader.cmake +++ b/src/GenerateVersionHeader.cmake @@ -1,12 +1,12 @@ # Credits to https://github.com/nocnokneo/cmake-git-versioning-example # Copyright (c) 2021 Taylor Braun-Jones if(GIT_EXECUTABLE) - get_filename_component(SRC_DIR ${CMAKE_SOURCE_DIR} DIRECTORY) - #message (${SRC_DIR}) + #get_filename_component(SRC_DIR ${CMAKE_SOURCE_DIR} DIRECTORY) + message (${OOFEM_SRC_DIR}) execute_process( #COMMAND ${GIT_EXECUTABLE} log -1 --format=%h COMMAND ${GIT_EXECUTABLE} describe --tags --dirty - WORKING_DIRECTORY ${SRC_DIR} + WORKING_DIRECTORY ${OOFEM_SRC_DIR} OUTPUT_VARIABLE GIT_HASH RESULT_VARIABLE GIT_HASH_ERROR_CODE OUTPUT_STRIP_TRAILING_WHITESPACE @@ -18,7 +18,7 @@ if(GIT_EXECUTABLE) # get repository URL & branch execute_process( COMMAND ${GIT_EXECUTABLE} remote get-url origin - WORKING_DIRECTORY ${SRC_DIR} + WORKING_DIRECTORY ${OOFEM_SRC_DIR} OUTPUT_VARIABLE GIT_REPOURL RESULT_VARIABLE GIT_REPOURL_ERROR_CODE OUTPUT_STRIP_TRAILING_WHITESPACE @@ -29,7 +29,7 @@ if(GIT_EXECUTABLE) execute_process( COMMAND ${GIT_EXECUTABLE} branch --show-current - WORKING_DIRECTORY ${SRC_DIR} + WORKING_DIRECTORY ${OOFEM_SRC_DIR} OUTPUT_VARIABLE GIT_BRANCH RESULT_VARIABLE GIT_BRANCHL_ERROR_CODE OUTPUT_STRIP_TRAILING_WHITESPACE diff --git a/src/am/additivemanufacturingproblem.C b/src/am/additivemanufacturingproblem.C index 9953f76f2..ae477a6fc 100644 --- a/src/am/additivemanufacturingproblem.C +++ b/src/am/additivemanufacturingproblem.C @@ -680,7 +680,7 @@ void AdditiveManufacturingProblem ::initializeFrom( InputRecord &ir ) fprintf( outputStream, "\nStarting analysis on: %s\n", ctime( &this->startTime ) ); fprintf( outputStream, "%s\n", simulationDescription.c_str() ); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( this->isParallel() ) { fprintf( outputStream, "Problem rank is %d/%d on %s\n\n", this->rank, this->numProcs, this->processor_name ); } @@ -1001,7 +1001,7 @@ void AdditiveManufacturingProblem ::solveYourself() sp->giveCurrentStep()->giveNumber(), _steptime ); } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( loadBalancingFlag ) { this->balanceLoad( sp->giveCurrentStep() ); } diff --git a/src/dss/dsssolver.h b/src/dss/dsssolver.h index db61008e9..37cf4679e 100644 --- a/src/dss/dsssolver.h +++ b/src/dss/dsssolver.h @@ -35,7 +35,7 @@ #ifndef dsssolver_h #define dsssolver_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "sparselinsystemnm.h" #include "convergedreason.h" #include "sparsemtrx.h" diff --git a/src/fm/cbs.C b/src/fm/cbs.C index a7fdc06ac..1a76fc543 100644 --- a/src/fm/cbs.C +++ b/src/fm/cbs.C @@ -216,7 +216,7 @@ CBS :: giveTractionPressure(Dof *dof) OOFEM_ERROR("prescribed traction pressure requested for dof with no BC"); } - return 0; + // return 0; } @@ -269,7 +269,7 @@ CBS :: solveYourselfAt(TimeStep *tStep) int momneq = this->giveNumberOfDomainEquations(1, vnum); int presneq = this->giveNumberOfDomainEquations(1, pnum); int presneq_prescribed = this->giveNumberOfDomainEquations(1, pnumPrescribed); - double deltaT = tStep->giveTimeIncrement(); + double dt = tStep->giveTimeIncrement(); if ( initFlag ) { deltaAuxVelocity.resize(momneq); @@ -290,7 +290,7 @@ CBS :: solveYourselfAt(TimeStep *tStep) this->assemble( *lhs, stepWhenIcApply.get(), PressureLhsAssembler(), pnum, this->giveDomain(1) ); - lhs->times(deltaT * theta1 * theta2); + lhs->times(dt * theta1 * theta2); if ( consistentMassFlag ) { mss = classFactory.createSparseMtrx(sparseMtrxType); @@ -322,7 +322,7 @@ CBS :: solveYourselfAt(TimeStep *tStep) lhs->zero(); this->assemble( *lhs, stepWhenIcApply.get(), PressureLhsAssembler(), pnum, this->giveDomain(1) ); - lhs->times(deltaT * theta1 * theta2); + lhs->times(dt * theta1 * theta2); if ( consistentMassFlag ) { mss->zero(); @@ -338,8 +338,8 @@ CBS :: solveYourselfAt(TimeStep *tStep) // if ( tStep->isTheFirstStep() ) { - TimeStep *stepWhenIcApply = tStep->givePreviousStep(); - this->applyIC(stepWhenIcApply); + TimeStep *_stepWhenIcApply = tStep->givePreviousStep(); + this->applyIC(_stepWhenIcApply); } velocityField.advanceSolution(tStep); @@ -365,13 +365,13 @@ CBS :: solveYourselfAt(TimeStep *tStep) //this->assembleVectorFromElements(mm, tStep, LumpedMassVectorAssembler(), VM_Total, this->giveDomain(1)); if ( consistentMassFlag ) { - rhs.times(deltaT); + rhs.times(dt); // Depends on prescribed v this->assembleVectorFromElements( rhs, tStep, PrescribedVelocityRhsAssembler(), VM_Total, vnum, this->giveDomain(1) ); nMethod->solve(*mss, rhs, deltaAuxVelocity); } else { for ( int i = 1; i <= momneq; i++ ) { - deltaAuxVelocity.at(i) = deltaT * rhs.at(i) / mm.at(i); + deltaAuxVelocity.at(i) = dt * rhs.at(i) / mm.at(i); } } @@ -406,14 +406,14 @@ CBS :: solveYourselfAt(TimeStep *tStep) // Depends on p: this->assembleVectorFromElements( rhs, tStep, CorrectionRhsAssembler(), VM_Total, vnum, this->giveDomain(1) ); if ( consistentMassFlag ) { - rhs.times(deltaT); + rhs.times(dt); //this->assembleVectorFromElements(rhs, tStep, PrescribedRhsAssembler(), VM_Incremental, vnum, this->giveDomain(1)); nMethod->solve(*mss, rhs, velocityVector); velocityVector.add(deltaAuxVelocity); velocityVector.add(prevVelocityVector); } else { for ( int i = 1; i <= momneq; i++ ) { - velocityVector.at(i) = prevVelocityVector.at(i) + deltaAuxVelocity.at(i) + deltaT *rhs.at(i) / mm.at(i); + velocityVector.at(i) = prevVelocityVector.at(i) + deltaAuxVelocity.at(i) + dt *rhs.at(i) / mm.at(i); } } this->velocityField.update(VM_Total, tStep, velocityVector, this->vnum ); @@ -425,13 +425,13 @@ CBS :: solveYourselfAt(TimeStep *tStep) // if ( materialInterface ) { #ifdef TIME_REPORT - Timer timer; - timer.startTimer(); + Timer _timer; + _timer.startTimer(); #endif materialInterface->updatePosition( this->giveCurrentStep() ); #ifdef TIME_REPORT - timer.stopTimer(); - OOFEM_LOG_INFO( "CBS info: user time consumed by updating interfaces: %.2fs\n", timer.getUtime() ); + _timer.stopTimer(); + OOFEM_LOG_INFO( "CBS info: user time consumed by updating interfaces: %.2fs\n", _timer.getUtime() ); #endif } @@ -569,7 +569,7 @@ CBS :: printDofOutputAt(FILE *stream, Dof *iDof, TimeStep *tStep) void -CBS :: applyIC(TimeStep *stepWhenIcApply) +CBS :: applyIC(TimeStep *_stepWhenIcApply) { #ifdef VERBOSE OOFEM_LOG_INFO("Applying initial conditions\n"); @@ -580,8 +580,8 @@ CBS :: applyIC(TimeStep *stepWhenIcApply) // update element state according to given ic for ( auto &elem : this->giveDomain(1)->giveElements() ) { CBSElement *element = static_cast< CBSElement * >( elem.get() ); - element->updateInternalState(stepWhenIcApply); - element->updateYourself(stepWhenIcApply); + element->updateInternalState(_stepWhenIcApply); + element->updateYourself(_stepWhenIcApply); } } @@ -597,7 +597,7 @@ CBS :: giveNewEquationNumber(int domain, DofIDItem id) OOFEM_ERROR("Unknown DofIDItem"); } - return 0; + // return 0; } @@ -612,7 +612,7 @@ CBS :: giveNewPrescribedEquationNumber(int domain, DofIDItem id) OOFEM_ERROR("Unknown DofIDItem"); } - return 0; + //return 0; } @@ -646,7 +646,7 @@ double CBS :: giveVariableScale(VarScaleType varID) OOFEM_ERROR("unknown variable type"); } - return 0.0; + //return 0.0; } #if 0 diff --git a/src/fm/fluidmaterialevaluator.C b/src/fm/fluidmaterialevaluator.C index 70dc61ad2..314ef627c 100644 --- a/src/fm/fluidmaterialevaluator.C +++ b/src/fm/fluidmaterialevaluator.C @@ -86,7 +86,6 @@ void FluidMaterialEvaluator :: solveYourself() if ( ndim == 1 ) { OOFEM_ERROR("1d flow not supported (should be added)") //mode = _1dFlow; - mode = _Unknown; } else if ( ndim == 2 ) { mode = _2dFlow; } else { diff --git a/src/fm/hexa21stokes.h b/src/fm/hexa21stokes.h index 2790097db..799116aae 100644 --- a/src/fm/hexa21stokes.h +++ b/src/fm/hexa21stokes.h @@ -84,6 +84,8 @@ public SpatialLocalizerInterface const char *giveClassName() const override { return "Hexa21Stokes"; } const char *giveInputRecordName() const override { return _IFT_Hexa21Stokes_Name; } MaterialMode giveMaterialMode() override { return _3dFlow; } + Element_Geometry_Type giveGeometryType() const override {return EGT_hexa_27;} + int computeNumberOfDofs() override; diff --git a/src/fm/leplic.h b/src/fm/leplic.h index 6767a5b92..76b61a555 100644 --- a/src/fm/leplic.h +++ b/src/fm/leplic.h @@ -67,7 +67,7 @@ class LEPlicElementInterface : public Interface FloatArray normal, temp_normal; public: - LEPlicElementInterface() : permanentVofFlag(false), vof(0.), temp_vof(0.) { } + LEPlicElementInterface() : permanentVofFlag(false), vof(0.), temp_vof(0.), p(0.), temp_p(0.) { } /** * @name The element interface required by LEPlicElementInterface */ diff --git a/src/fm/line2boundaryelement.h b/src/fm/line2boundaryelement.h index dc7c91dc5..677b7ba2e 100644 --- a/src/fm/line2boundaryelement.h +++ b/src/fm/line2boundaryelement.h @@ -74,6 +74,7 @@ public SpatialLocalizerInterface const char *giveClassName() const override { return "Line2BoundaryElement"; } const char *giveInputRecordName() const override { return _IFT_Line2BoundaryElement_Name; } + Element_Geometry_Type giveGeometryType() const override {return EGT_line_2;} // Interfaces Interface *giveInterface(InterfaceType it) override; diff --git a/src/fm/pfem/pfemelement.C b/src/fm/pfem/pfemelement.C index fe3e526b7..f6eb9b30d 100644 --- a/src/fm/pfem/pfemelement.C +++ b/src/fm/pfem/pfemelement.C @@ -213,7 +213,7 @@ void PFEMElement :: printOutputAt(FILE *file, TimeStep *tStep) const // Performs end-of-step operations. { -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE fprintf( file, "element %d [%8d] :\n", this->giveNumber(), this->giveGlobalNumber() ); #else fprintf(file, "element %d :\n", number); diff --git a/src/fm/quad10_2d_supg.h b/src/fm/quad10_2d_supg.h index 32612633e..c850f62e6 100644 --- a/src/fm/quad10_2d_supg.h +++ b/src/fm/quad10_2d_supg.h @@ -71,6 +71,8 @@ class Quad10_2D_SUPG : public SUPGElement2, public LevelSetPCSElementInterface, const char *giveClassName() const override { return "Quad1_2D_SUPG"; } const char *giveInputRecordName() const override { return _IFT_Quad10_2D_SUPG_Name; } MaterialMode giveMaterialMode() override { return _2dFlow; } + Element_Geometry_Type giveGeometryType() const override {return EGT_quad_1;} + void giveInternalDofManDofIDMask(int i, IntArray &answer) const override; void giveDofManDofIDMask(int inode, IntArray &answer) const override; diff --git a/src/fm/stokesflow.C b/src/fm/stokesflow.C index fbe3787c5..e03ae0db2 100644 --- a/src/fm/stokesflow.C +++ b/src/fm/stokesflow.C @@ -209,11 +209,11 @@ void StokesFlow :: updateSolution(FloatArray &solutionVector, TimeStep *tStep, D } -void StokesFlow :: updateInternalRHS(FloatArray &answer, TimeStep *tStep, Domain *d, FloatArray *eNorm) +void StokesFlow :: updateInternalRHS(FloatArray &answer, TimeStep *tStep, Domain *d, FloatArray *enorm) { answer.zero(); this->assembleVector(answer, tStep, InternalForceAssembler(), VM_Total, - EModelDefaultEquationNumbering(), d, eNorm); + EModelDefaultEquationNumbering(), d, enorm); this->updateSharedDofManagers(answer, EModelDefaultEquationNumbering(), InternalForcesExchangeTag); } diff --git a/src/fm/supg.C b/src/fm/supg.C index b5c69e0fc..3e551dc64 100644 --- a/src/fm/supg.C +++ b/src/fm/supg.C @@ -375,11 +375,11 @@ void SUPG :: updateSolution(FloatArray &solutionVector, TimeStep *tStep, Domain } -void SUPG :: updateInternalRHS(FloatArray &answer, TimeStep *tStep, Domain *d, FloatArray *eNorm) +void SUPG :: updateInternalRHS(FloatArray &answer, TimeStep *tStep, Domain *d, FloatArray *enorm) { answer.zero(); this->assembleVector(answer, tStep, SUPGInternalForceAssembler(lscale, dscale, uscale), VM_Total, - EModelDefaultEquationNumbering(), d, eNorm); + EModelDefaultEquationNumbering(), d, enorm); this->updateSharedDofManagers(answer, EModelDefaultEquationNumbering(), InternalForcesExchangeTag); } @@ -472,12 +472,12 @@ SUPG :: solveYourselfAt(TimeStep *tStep) this->internalForces.resize(neq); if ( tStep->isTheFirstStep() ) { - TimeStep *stepWhenIcApply = tStep->givePreviousStep(); + TimeStep *_stepWhenIcApply = tStep->givePreviousStep(); if ( materialInterface ) { materialInterface->initialize(); } - this->applyIC(stepWhenIcApply); + this->applyIC(_stepWhenIcApply); //if (this->fsflag) this->updateDofManActivityMap(tStep); } @@ -595,16 +595,16 @@ SUPG :: solveYourselfAt(TimeStep *tStep) int nite = 0; double _absErrResid, err, avn = 0.0, aivn = 0.0, rnorm; int jj, nnodes = this->giveDomain(1)->giveNumberOfDofManagers(); - FloatArray rhs, internalForces(neq); + FloatArray rhs, iForces(neq); // algoritmic rhs part (assembled by e-model (in giveCharComponent service) from various element contribs) - internalForces.zero(); - this->assembleVector( internalForces, tStep, SUPGInternalForceAssembler(lscale, dscale, uscale), VM_Total, + iForces.zero(); + this->assembleVector( iForces, tStep, SUPGInternalForceAssembler(lscale, dscale, uscale), VM_Total, EModelDefaultEquationNumbering(), this->giveDomain(1) ); - this->updateSharedDofManagers(internalForces, EModelDefaultEquationNumbering(), InternalForcesExchangeTag); + this->updateSharedDofManagers(iForces, EModelDefaultEquationNumbering(), InternalForcesExchangeTag); - rhs.beDifferenceOf(externalForces, internalForces); + rhs.beDifferenceOf(externalForces, iForces); // // corrector @@ -703,11 +703,11 @@ SUPG :: solveYourselfAt(TimeStep *tStep) // // assemble rhs (residual) // - internalForces.zero(); - this->assembleVector( internalForces, tStep, SUPGInternalForceAssembler(lscale, dscale, uscale), VM_Total, + iForces.zero(); + this->assembleVector( iForces, tStep, SUPGInternalForceAssembler(lscale, dscale, uscale), VM_Total, EModelDefaultEquationNumbering(), this->giveDomain(1) ); - this->updateSharedDofManagers(internalForces, EModelDefaultEquationNumbering(), InternalForcesExchangeTag); - rhs.beDifferenceOf(externalForces, internalForces); + this->updateSharedDofManagers(iForces, EModelDefaultEquationNumbering(), InternalForcesExchangeTag); + rhs.beDifferenceOf(externalForces, iForces); // check convergence and repeat iteration if desired double rnorm_mb = 0.0, rnorm_mc = 0.0; @@ -748,11 +748,11 @@ SUPG :: solveYourselfAt(TimeStep *tStep) // // assemble rhs (residual) // - internalForces.zero(); - this->assembleVector( internalForces, tStep, SUPGInternalForceAssembler(lscale, dscale, uscale), VM_Total, + iForces.zero(); + this->assembleVector( iForces, tStep, SUPGInternalForceAssembler(lscale, dscale, uscale), VM_Total, EModelDefaultEquationNumbering(), this->giveDomain(1) ); - this->updateSharedDofManagers(internalForces, EModelDefaultEquationNumbering(), InternalForcesExchangeTag); - rhs.beDifferenceOf(externalForces, internalForces); + this->updateSharedDofManagers(iForces, EModelDefaultEquationNumbering(), InternalForcesExchangeTag); + rhs.beDifferenceOf(externalForces, iForces); } } while ( ( rnorm > rtolv ) && ( _absErrResid > atolv ) && ( nite <= maxiter ) ); @@ -771,14 +771,14 @@ SUPG :: solveYourselfAt(TimeStep *tStep) #ifndef SUPG_IMPLICIT_INTERFACE if ( materialInterface ) { #ifdef TIME_REPORT - Timer timer; - timer.startTimer(); + Timer _timer; + _timer.startTimer(); #endif materialInterface->updatePosition( this->giveCurrentStep() ); updateElementsForNewInterfacePosition(tStep); #ifdef TIME_REPORT - timer.stopTimer(); - OOFEM_LOG_INFO( "SUPG info: user time consumed by updating interfaces: %.2fs\n", timer.getUtime() ); + _timer.stopTimer(); + OOFEM_LOG_INFO( "SUPG info: user time consumed by updating interfaces: %.2fs\n", _timer.getUtime() ); #endif //if (this->fsflag) this->updateDofManActivityMap(tStep); } @@ -1012,7 +1012,7 @@ SUPG :: giveVariableScale(VarScaleType varID) OOFEM_ERROR("unknown variable type"); } - return 0.0; + //return 0.0; } void @@ -1058,7 +1058,7 @@ SUPG :: updateDofUnknownsDictionary(DofManager *inode, TimeStep *tStep) void SUPG :: updateDofUnknownsDictionary_predictor(TimeStep *tStep) { - double deltaT = tStep->giveTimeIncrement(); + double dt = tStep->giveTimeIncrement(); Domain *domain = this->giveDomain(1); int nnodes = domain->giveNumberOfDofManagers(); @@ -1073,7 +1073,7 @@ SUPG :: updateDofUnknownsDictionary_predictor(TimeStep *tStep) prev_val = dof->giveUnknown( VM_Total, tStep->givePreviousStep() ); accel = dof->giveUnknown( VM_Acceleration, tStep->givePreviousStep() ); if ( ( type == V_u ) || ( type == V_v ) || ( type == V_w ) ) { - val = prev_val + deltaT * accel; + val = prev_val + dt * accel; } else { val = prev_val; } @@ -1094,7 +1094,7 @@ SUPG :: updateDofUnknownsDictionary_predictor(TimeStep *tStep) void SUPG :: updateDofUnknownsDictionary_corrector(TimeStep *tStep) { - double deltaT = tStep->giveTimeIncrement(); + double dt = tStep->giveTimeIncrement(); Domain *domain = this->giveDomain(1); int nnodes = domain->giveNumberOfDofManagers(); @@ -1107,7 +1107,7 @@ SUPG :: updateDofUnknownsDictionary_corrector(TimeStep *tStep) double val, prev_val; prev_val = iDof->giveUnknown(VM_Total, tStep); if ( ( type == V_u ) || ( type == V_v ) || ( type == V_w ) ) { - val = prev_val + deltaT *alpha *incrementalSolutionVector.at( iDof->__giveEquationNumber() ); + val = prev_val + dt *alpha *incrementalSolutionVector.at( iDof->__giveEquationNumber() ); } else { val = prev_val + incrementalSolutionVector.at( iDof->__giveEquationNumber() ); } @@ -1131,14 +1131,12 @@ SUPG :: giveUnknownDictHashIndx(ValueModeType mode, TimeStep *tStep) } else { OOFEM_ERROR("unsupported solution step"); } - - return 0; } void SUPG :: updateSolutionVectors_predictor(FloatArray &solutionVector, FloatArray &accelerationVector, TimeStep *tStep) { - double deltaT = tStep->giveTimeIncrement(); + double dt = tStep->giveTimeIncrement(); Domain *domain = this->giveDomain(1); for ( auto &node : domain->giveDofManagers() ) { @@ -1151,8 +1149,8 @@ SUPG :: updateSolutionVectors_predictor(FloatArray &solutionVector, FloatArray & DofIDItem type = iDof->giveDofID(); if ( jj ) { - if ( ( type == V_u ) || ( type == V_v ) || ( type == V_w ) ) { // v = v + (deltaT)*a - solutionVector.at(jj) += deltaT * accelerationVector.at(jj); + if ( ( type == V_u ) || ( type == V_v ) || ( type == V_w ) ) { // v = v + (dt)*a + solutionVector.at(jj) += dt * accelerationVector.at(jj); } } } @@ -1171,8 +1169,8 @@ SUPG :: updateSolutionVectors_predictor(FloatArray &solutionVector, FloatArray & DofIDItem type = iDof->giveDofID(); if ( jj ) { - if ( ( type == V_u ) || ( type == V_v ) || ( type == V_w ) ) { // v = v + (deltaT*alpha)*da - solutionVector.at(jj) += deltaT * accelerationVector.at(jj); + if ( ( type == V_u ) || ( type == V_v ) || ( type == V_w ) ) { // v = v + (dt*alpha)*da + solutionVector.at(jj) += dt * accelerationVector.at(jj); } } } @@ -1184,7 +1182,7 @@ SUPG :: updateSolutionVectors_predictor(FloatArray &solutionVector, FloatArray & void SUPG :: updateSolutionVectors(FloatArray &solutionVector, FloatArray &accelerationVector, FloatArray &incrementalSolutionVector, TimeStep *tStep) { - double deltaT = tStep->giveTimeIncrement(); + double dt = tStep->giveTimeIncrement(); Domain *domain = this->giveDomain(1); accelerationVector.add(incrementalSolutionVector); @@ -1200,8 +1198,8 @@ SUPG :: updateSolutionVectors(FloatArray &solutionVector, FloatArray &accelerati DofIDItem type = iDof->giveDofID(); if ( jj ) { - if ( ( type == V_u ) || ( type == V_v ) || ( type == V_w ) ) { // v = v + (deltaT*alpha)*da - solutionVector.at(jj) += deltaT * alpha * incrementalSolutionVector.at(jj); + if ( ( type == V_u ) || ( type == V_v ) || ( type == V_w ) ) { // v = v + (dt*alpha)*da + solutionVector.at(jj) += dt * alpha * incrementalSolutionVector.at(jj); } else { solutionVector.at(jj) += incrementalSolutionVector.at(jj); // p = p + dp } @@ -1222,8 +1220,8 @@ SUPG :: updateSolutionVectors(FloatArray &solutionVector, FloatArray &accelerati DofIDItem type = iDof->giveDofID(); if ( jj ) { - if ( ( type == V_u ) || ( type == V_v ) || ( type == V_w ) ) { // v = v + (deltaT*alpha)*da - solutionVector.at(jj) += deltaT * alpha * incrementalSolutionVector.at(jj); + if ( ( type == V_u ) || ( type == V_v ) || ( type == V_w ) ) { // v = v + (dt*alpha)*da + solutionVector.at(jj) += dt * alpha * incrementalSolutionVector.at(jj); } else { solutionVector.at(jj) += incrementalSolutionVector.at(jj); // p = p + dp } diff --git a/src/fm/tet1_3d_supg.h b/src/fm/tet1_3d_supg.h index d1da2295e..2d9824077 100644 --- a/src/fm/tet1_3d_supg.h +++ b/src/fm/tet1_3d_supg.h @@ -61,6 +61,8 @@ class Tet1_3D_SUPG : public SUPGElement2, public LevelSetPCSElementInterface MaterialMode giveMaterialMode() override { return _3dFlow; } void giveDofManDofIDMask(int inode, IntArray &answer) const override; int computeNumberOfDofs() override; + Element_Geometry_Type giveGeometryType() const override {return EGT_tetra_1;} + Interface *giveInterface(InterfaceType t) override; diff --git a/src/fm/tet1bubblestokes.h b/src/fm/tet1bubblestokes.h index 317566ec0..d938e8ecc 100644 --- a/src/fm/tet1bubblestokes.h +++ b/src/fm/tet1bubblestokes.h @@ -95,6 +95,8 @@ public SpatialLocalizerInterface const char *giveClassName() const override { return "Tet1BubbleStokes"; } const char *giveInputRecordName() const override { return _IFT_Tet1BubbleStokes_Name; } MaterialMode giveMaterialMode() override { return _3dFlow; } + Element_Geometry_Type giveGeometryType() const override {return EGT_tetra_1;} + int computeNumberOfDofs() override; diff --git a/src/fm/tet21stokes.h b/src/fm/tet21stokes.h index c9f9de811..2a2195eff 100644 --- a/src/fm/tet21stokes.h +++ b/src/fm/tet21stokes.h @@ -86,6 +86,8 @@ public EIPrimaryUnknownMapperInterface const char *giveClassName() const override { return "Tet21Stokes"; } const char *giveInputRecordName() const override { return _IFT_Tet21Stokes_Name; } MaterialMode giveMaterialMode() override { return _3dFlow; } + Element_Geometry_Type giveGeometryType() const override {return EGT_tetra_2;} + int computeNumberOfDofs() override; diff --git a/src/fm/tr1_2d_cbs.C b/src/fm/tr1_2d_cbs.C index 64f305763..d832fbe7d 100644 --- a/src/fm/tr1_2d_cbs.C +++ b/src/fm/tr1_2d_cbs.C @@ -545,17 +545,17 @@ void TR1_2D_CBS :: computeDensityRhsPressureTerms(FloatArray &answer, TimeStep *tStep) { // computes pressure terms on RHS for density equation - FloatArray p; + FloatArray pv; double theta1 = static_cast< CBS * >( domain->giveEngngModel() )->giveTheta1(); - this->computeVectorOfPressures(VM_Total, tStep->givePreviousStep(), p); + this->computeVectorOfPressures(VM_Total, tStep->givePreviousStep(), pv); answer.resize(9); answer.zero(); double dpdx = 0.0, dpdy = 0.0; for ( int i = 0; i < 3; i++ ) { - dpdx += b [ i ] * p.at(i + 1); - dpdy += c [ i ] * p.at(i + 1); + dpdx += b [ i ] * pv.at(i + 1); + dpdy += c [ i ] * pv.at(i + 1); } for ( int i = 0; i < 3; i++ ) { @@ -585,16 +585,16 @@ void TR1_2D_CBS :: computeCorrectionRhs(FloatArray &answer, TimeStep *tStep) { //Evaluates the RHS of velocity correction step - FloatArray p, u; + FloatArray pv, u; double ar3; double usum, vsum, coeff; - this->computeVectorOfPressures(VM_Total, tStep, p); + this->computeVectorOfPressures(VM_Total, tStep, pv); double dpdx = 0.0, dpdy = 0.0; for ( int i = 0; i < 3; i++ ) { - double pn1 = p.at(i + 1); + double pn1 = pv.at(i + 1); dpdx += b [ i ] * pn1; dpdy += c [ i ] * pn1; } @@ -607,11 +607,11 @@ TR1_2D_CBS :: computeCorrectionRhs(FloatArray &answer, TimeStep *tStep) answer.at(2) = answer.at(5) = answer.at(8) = -ar3 * dpdy; - this->computeVectorOfPressures(VM_Total, tStep->givePreviousStep(), p); + this->computeVectorOfPressures(VM_Total, tStep->givePreviousStep(), pv); this->computeVectorOfVelocities(VM_Total, tStep->givePreviousStep(), u); dpdx = 0.0, dpdy = 0.0; for ( int i = 0; i < 3; i++ ) { - double pn1 = p.at(i + 1); + double pn1 = pv.at(i + 1); dpdx += b [ i ] * pn1; dpdy += c [ i ] * pn1; } diff --git a/src/fm/tr1_2d_cbs.h b/src/fm/tr1_2d_cbs.h index efa5302d4..98a3238a4 100644 --- a/src/fm/tr1_2d_cbs.h +++ b/src/fm/tr1_2d_cbs.h @@ -101,6 +101,8 @@ public ZZNodalRecoveryModelInterface, public NodalAveragingRecoveryModelInterfac const char *giveClassName() const override { return "TR1_2D_CBS"; } const char *giveInputRecordName() const override { return _IFT_TR1_2D_CBS_Name; } MaterialMode giveMaterialMode() override { return _2dFlow; } + Element_Geometry_Type giveGeometryType() const override {return EGT_triangle_1;} + void giveDofManDofIDMask(int inode, IntArray &answer) const override; int computeNumberOfDofs() override; diff --git a/src/fm/tr1_2d_supg.h b/src/fm/tr1_2d_supg.h index 9b29b8577..a56097802 100644 --- a/src/fm/tr1_2d_supg.h +++ b/src/fm/tr1_2d_supg.h @@ -121,6 +121,8 @@ public LEPlicElementInterface, public LevelSetPCSElementInterface const char *giveClassName() const override { return "TR1_2D_SUPG"; } const char *giveInputRecordName() const override { return _IFT_TR1_2D_SUPG_Name; } MaterialMode giveMaterialMode() override { return _2dFlow; } + Element_Geometry_Type giveGeometryType() const override {return EGT_triangle_1;} + void giveDofManDofIDMask(int inode, IntArray &answer) const override; int computeNumberOfDofs() override; diff --git a/src/fm/tr1_2d_supg2.C b/src/fm/tr1_2d_supg2.C index 2509ba60c..7b7ec71f1 100644 --- a/src/fm/tr1_2d_supg2.C +++ b/src/fm/tr1_2d_supg2.C @@ -1711,7 +1711,7 @@ TR1_2D_SUPG2 :: updateIntegrationRules() // remap ip coords into area coords of receiver for ( GaussPoint *gp: *integrationRulesArray [ i ] ) { - approx->local2global( gc, gp->giveNaturalCoordinates(), FEIVertexListGeometryWrapper(vcoords [ i ]) ); + approx->local2global( gc, gp->giveNaturalCoordinates(), FEIVertexListGeometryWrapper(vcoords [ i ], approx->giveGeometryType()) ); triaApprox.global2local( lc, gc, FEIElementGeometryWrapper(this) ); // modify original ip coords to target ones gp->setSubPatchCoordinates( gp->giveNaturalCoordinates() ); @@ -1733,7 +1733,7 @@ TR1_2D_SUPG2 :: updateIntegrationRules() double __err = fabs(__area - area) / area; if ( __err > 1.e-6 ) { OOFEM_ERROR("volume inconsistency (%5.2f)", __err * 100); - + /* __area = 0.0; for ( int ifluid = 0; ifluid < 2; ifluid++ ) { for ( GaussPoint *gp: *integrationRulesArray [ ifluid ] ) { @@ -1742,6 +1742,7 @@ TR1_2D_SUPG2 :: updateIntegrationRules() __area += dV; } } + */ } } @@ -1753,10 +1754,10 @@ TR1_2D_SUPG2 :: computeVolumeAroundID(GaussPoint *gp, integrationDomain id, cons if ( id == _Triangle ) { FEI2dTrLin __interpolation(1, 2); - return weight *fabs( __interpolation.giveTransformationJacobian ( gp->giveSubPatchCoordinates(), FEIVertexListGeometryWrapper(idpoly) ) ); + return weight *fabs( __interpolation.giveTransformationJacobian ( gp->giveSubPatchCoordinates(), FEIVertexListGeometryWrapper(idpoly, __interpolation.giveGeometryType()) ) ); } else { FEI2dQuadLin __interpolation(1, 2); - double det = fabs( __interpolation.giveTransformationJacobian( gp->giveSubPatchCoordinates(), FEIVertexListGeometryWrapper(idpoly) ) ); + double det = fabs( __interpolation.giveTransformationJacobian( gp->giveSubPatchCoordinates(), FEIVertexListGeometryWrapper(idpoly, __interpolation.giveGeometryType()) ) ); return det * weight; } } diff --git a/src/fm/tr1_2d_supg2_axi.C b/src/fm/tr1_2d_supg2_axi.C index b153ce148..7fed3e75e 100644 --- a/src/fm/tr1_2d_supg2_axi.C +++ b/src/fm/tr1_2d_supg2_axi.C @@ -1533,7 +1533,7 @@ TR1_2D_SUPG2_AXI :: updateIntegrationRules() // remap ip coords into area coords of receiver for ( GaussPoint *gp: *integrationRulesArray [ i ] ) { - approx->local2global( gc, gp->giveNaturalCoordinates(), FEIVertexListGeometryWrapper(vcoords [ i ]) ); + approx->local2global( gc, gp->giveNaturalCoordinates(), FEIVertexListGeometryWrapper(vcoords [ i ], approx->giveGeometryType()) ); triaApprox.global2local( lc, gc, FEIElementGeometryWrapper(this) ); // modify original ip coords to target ones gp->setSubPatchCoordinates( gp->giveNaturalCoordinates() ); @@ -1541,7 +1541,7 @@ TR1_2D_SUPG2_AXI :: updateIntegrationRules() //gp->setWeight (gp->giveWeight()*a/area); } } - +#if 0 // internal test -> compute receiver area double dV, __area = 0.0; for ( int ifluid = 0; ifluid < 2; ifluid++ ) { @@ -1552,21 +1552,21 @@ TR1_2D_SUPG2_AXI :: updateIntegrationRules() } } - /* - * double __err = fabs(__area-area)/area; - * if (__err > 1.e-6) { - * OOFEM_WARNING("volume inconsistency (%5.2f\%)", __err*100); - * - * __area=0.0; - * for (ifluid = 0; ifluid< 2; ifluid++) { - * for (GaussPoint *gp: *integrationRulesArray[ifluid]) { - * dV = this->computeVolumeAroundID(gp,id[ifluid], vcoords[ifluid]) ; - * // compute integral here - * __area += dV; - * } - * } - * } - */ + + double __err = fabs(__area-area)/area; + if (__err > 1.e-6) { + OOFEM_WARNING("volume inconsistency (%5.2f\%)", __err*100); + + __area=0.0; + for (ifluid = 0; ifluid< 2; ifluid++) { + for (GaussPoint *gp: *integrationRulesArray[ifluid]) { + dV = this->computeVolumeAroundID(gp,id[ifluid], vcoords[ifluid]) ; + // compute integral here + __area += dV; + } + } + } +#endif } @@ -1597,10 +1597,10 @@ TR1_2D_SUPG2_AXI :: computeVolumeAroundID(GaussPoint *gp, integrationDomain id, if ( id == _Triangle ) { FEI2dTrLin __interpolation(1, 2); - return _r *weight *fabs( __interpolation.giveTransformationJacobian ( gp->giveSubPatchCoordinates(), FEIVertexListGeometryWrapper(idpoly) ) ); + return _r *weight *fabs( __interpolation.giveTransformationJacobian ( gp->giveSubPatchCoordinates(), FEIVertexListGeometryWrapper(idpoly, __interpolation.giveGeometryType()) ) ); } else { FEI2dQuadLin __interpolation(1, 2); - double det = fabs( __interpolation.giveTransformationJacobian( gp->giveSubPatchCoordinates(), FEIVertexListGeometryWrapper(idpoly) ) ); + double det = fabs( __interpolation.giveTransformationJacobian( gp->giveSubPatchCoordinates(), FEIVertexListGeometryWrapper(idpoly, __interpolation.giveGeometryType()) ) ); return _r * det * weight; } } diff --git a/src/fm/tr1bubblestokes.h b/src/fm/tr1bubblestokes.h index 3109a7f10..dc33cce0c 100644 --- a/src/fm/tr1bubblestokes.h +++ b/src/fm/tr1bubblestokes.h @@ -91,6 +91,7 @@ public SpatialLocalizerInterface const char *giveClassName() const override { return "Tr1BubbleStokes"; } const char *giveInputRecordName() const override { return _IFT_Tr1BubbleStokes_Name; } MaterialMode giveMaterialMode() override { return _2dFlow; } + Element_Geometry_Type giveGeometryType() const override {return EGT_triangle_1;} int computeNumberOfDofs() override; diff --git a/src/fm/tr21_2d_supg.h b/src/fm/tr21_2d_supg.h index 52ba848a8..3ca80e2f3 100644 --- a/src/fm/tr21_2d_supg.h +++ b/src/fm/tr21_2d_supg.h @@ -70,6 +70,8 @@ class TR21_2D_SUPG : public SUPGElement2, public LevelSetPCSElementInterface, pu const char *giveClassName() const override { return "TR21_2D_SUPG"; } const char *giveInputRecordName() const override { return _IFT_TR21_2D_SUPG_Name; } MaterialMode giveMaterialMode() override { return _2dFlow; } + Element_Geometry_Type giveGeometryType() const override {return EGT_triangle_2;} + void giveDofManDofIDMask(int inode, IntArray &answer) const override; int computeNumberOfDofs() override; diff --git a/src/fm/tr21stokes.h b/src/fm/tr21stokes.h index 6f7c17f8d..7c7ad9158 100644 --- a/src/fm/tr21stokes.h +++ b/src/fm/tr21stokes.h @@ -89,6 +89,8 @@ public SpatialLocalizerInterface const char *giveClassName() const override { return "Tr21Stokes"; } const char *giveInputRecordName() const override { return _IFT_Tr21Stokes_Name; } MaterialMode giveMaterialMode() override { return _2dFlow; } + Element_Geometry_Type giveGeometryType() const override {return EGT_triangle_2;} + int computeNumberOfDofs() override; diff --git a/src/main/main.C b/src/main/main.C index 2ac410805..c26db5557 100644 --- a/src/main/main.C +++ b/src/main/main.C @@ -41,6 +41,7 @@ #include "engngm.h" #include "oofemcfg.h" +#include "oofemenv.h" #include "oofemtxtdatareader.h" #include "datastream.h" @@ -50,7 +51,7 @@ #include "contextioerr.h" #include "oofem_terminate.h" -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE #include "dyncombuff.h" #endif @@ -136,10 +137,7 @@ int main(int argc, char *argv[]) int rank = 0; - // print header to redirected output - OOFEM_LOG_FORCED(PRG_HEADER_SM); - -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE #ifdef __USE_MPI MPI_Init(& argc, & argv); MPI_Comm_rank(MPI_COMM_WORLD, & rank); @@ -147,6 +145,10 @@ int main(int argc, char *argv[]) #endif #endif + // print header to redirected output + OOFEM_LOG_FORCED(PRG_HEADER_SM); + + // // check for options // @@ -208,7 +210,7 @@ int main(int argc, char *argv[]) } else if ( strcmp(argv [ i ], "-d") == 0 ) { debugFlag = true; } else if ( strcmp(argv [ i ], "-p") == 0 ) { -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE parallelFlag = true; #else fprintf(stderr, "\nCan't use -p, not compiled with parallel support\a\n\n"); @@ -272,7 +274,7 @@ int main(int argc, char *argv[]) PyRun_SimpleString("sys.path.append(\".\")"); #endif -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( parallelFlag ) { inputFileName << "." << rank; outputFileName << "." << rank; @@ -335,7 +337,7 @@ int main(int argc, char *argv[]) } problem->terminateAnalysis(); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( parallelFlag ) { DynamicCommunicationBuffer :: printInfo(); } @@ -411,7 +413,7 @@ void oofem_debug(EngngModel &emodel) //FloatMatrix k; //((BsplinePlaneStressElement*)emodel.giveDomain(1)->giveElement(1))->giveCharacteristicMatrix(k, StiffnessMatrix, NULL); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE //LoadBalancer* lb = emodel.giveDomain(1)->giveLoadBalancer(); //lb->calculateLoadTransfer(); //lb->migrateLoad(); diff --git a/src/main/oofeg.C b/src/main/oofeg.C index 4a3139323..bc92473b7 100644 --- a/src/main/oofeg.C +++ b/src/main/oofeg.C @@ -53,6 +53,7 @@ #include "node.h" #include "intarray.h" #include "oofemcfg.h" +#include "oofemenv.h" #include "errorestimator.h" #include "remeshingcrit.h" #include "drawmode.h" @@ -324,7 +325,7 @@ main(int argc, char *argv[]) oofem_logger.setLogLevel(level); } } else if ( strcmp(argv [ i ], "-p") == 0 ) { -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE parallelFlag = true; #else fprintf(stderr, "\nCan't use -p, not compiled with parallel support\a\n\n"); diff --git a/src/mpm/CMakeLists.txt b/src/mpm/CMakeLists.txt index 07d04e7d1..40606e15b 100644 --- a/src/mpm/CMakeLists.txt +++ b/src/mpm/CMakeLists.txt @@ -1,9 +1,11 @@ set (mpm_element termlibrary.C termlibrary2.C + termlibrary3.C prototype.C - #prototype2.C + prototype2.C up.C + tm.C ) set (mpm_problems diff --git a/src/mpm/integral.h b/src/mpm/integral.h new file mode 100644 index 000000000..cdd458e8c --- /dev/null +++ b/src/mpm/integral.h @@ -0,0 +1,150 @@ +/* + * + * ##### ##### ###### ###### ### ### + * ## ## ## ## ## ## ## ### ## + * ## ## ## ## #### #### ## # ## + * ## ## ## ## ## ## ## ## + * ## ## ## ## ## ## ## ## + * ##### ##### ## ###### ## ## + * + * + * OOFEM : Object Oriented Finite Element Code + * + * Copyright (C) 1993 - 2013 Borek Patzak + * + * + * + * Czech Technical University, Faculty of Civil Engineering, + * Department of Structural Mechanics, 166 29 Prague, Czech Republic + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +#ifndef integral_h +#define integral_h + +#include "mpm.h" +#include "set.h" +#include "intarray.h" +#include "domain.h" +#include "sparsemtrx.h" + +namespace oofem { + /** + * @brief Class representing weak form integral + * + */ + class Integral { + public: + + Set &set; + const Term &term; + Domain *domain; + /// @brief Constructor, creates an integral of given term over entities in given set + /// @param d + /// @param s + /// @param t + Integral (Domain* d, Set& s, const Term& t ) : set(s), term(t) { + this->domain = d; + } + /// @brief Initialize the integal domain + void initialize() { + for (auto i: this->set.giveElementList()) { // loop over elements + // introduce necessary dofs and set-up integration rules + this->term.initializeCell(*(domain->giveElement(i))); + } + } + // evaluate term contribution to weak form on given cell at given point + void assemble_lhs (SparseMtrx& dest, const UnknownNumberingScheme &s, TimeStep* tStep) const { + FloatMatrix contrib; + IntArray locr, locc; + + for (auto i: this->set.giveElementList()) { // loop over elements + MPElement *e = dynamic_cast(this->domain->giveElement(i)); + if (e) { + this->getElementTermCodeNumbers(locr, locc, e, this->term, s); + // determine integration rule (this has to be set up on element, as we need to track history there) + // the IR is created by term.initialize, we just need mechanism to get this IR + // specific terms can have specific integration requirements (reduced integration, etc) + // at the same time same rules should be shared between terms-> + // ->need to querry/store/identify element IR based on NIP. + IntegrationRule* ir = this->term.giveElementIntegrationRule(e); + e->integrateTerm_dw(contrib, this->term, ir, tStep); // @todo IR + // assemble + dest.assemble (locr, locc, contrib); + } + } + } + // evaluate contribution (all vars known) on given cell + void assemble_rhs (FloatArray& dest, const UnknownNumberingScheme &s, TimeStep* tstep) { + FloatArray contrib; + IntArray locr, locc; + + for (auto i: this->set.giveElementList()) { // loop over elements + MPElement *e = dynamic_cast(this->domain->giveElement(i)); + if (e) { + this->getElementTermCodeNumbers(locr, locc, e, this->term, s); + // determine integration rule (this has to be set up on element, as we need to track history there) + // the IR is created by term.initialize, we just need mechanism to get this IR + // specific terms can have specific integration requirements (reduced integration, etc) + // at the same time same rules should be shared between terms-> + // ->need to querry/store/identify element IR based on NIP. + IntegrationRule* ir = this->term.giveElementIntegrationRule(e); + e->integrateTerm_c(contrib, this->term, ir, tstep); // @todo IR + // assemble + dest.assemble (contrib, locr); + } + } + + + } + void getElementTermCodeNumbers (IntArray &locr, IntArray &locc, Element* e, const Term& t, const UnknownNumberingScheme &s) const { + IntArray nodes, internalDofMans, loc; + locr.resize(0); + locc.resize(0); + // term.field and its interpolation determines row code numbers + // from interpolation get node and internalDofMan lists + t.field.interpolation.giveCellDofMans(nodes, internalDofMans, e); + // loop over dof managers to get code numbers + for (int i: nodes) { + // get mode dofID mask + e->giveDofManager(i)->giveLocationArray(t.field.getDofManDofIDs(), loc, s); + locr.followedBy(loc); + } + for (int i: internalDofMans) { + e->giveInternalDofManager(i)->giveLocationArray(t.field.getDofManDofIDs(), loc, s); + locr.followedBy(loc); + } + + // term.testField and its interpolation determines column code numbers + // from interpolation get node and internalDofMan lists + t.testField.interpolation.giveCellDofMans(nodes, internalDofMans, e); + // loop over dof managers to get code numbers + for (int i: nodes) { + // get mode dofID mask + e->giveDofManager(i)->giveLocationArray(t.field.getDofManDofIDs(), loc, s); + locc.followedBy(loc); + } + for (int i: internalDofMans) { + + + e->giveInternalDofManager(i)->giveLocationArray(t.field.getDofManDofIDs(), loc, s); + locc.followedBy(loc); + } + } + }; + +} // namespace oofem + +#endif // integral_h \ No newline at end of file diff --git a/src/mpm/mpm.h b/src/mpm/mpm.h index 48ff8ba91..77e52f13b 100644 --- a/src/mpm/mpm.h +++ b/src/mpm/mpm.h @@ -264,20 +264,50 @@ class MPElement : public Element { /** Returns mapping from quantity dofs to local surface dofs - */ + */ virtual void getSurfaceLocalCodeNumbers (IntArray& answer, const Variable::VariableQuantity q) const =0; virtual void getEdgeLocalCodeNumbers (IntArray& answer, const Variable::VariableQuantity q) const =0; - - /* - virtual void getSurfaceLocalCodeNumbers (IntArray& answer, const Variable::VariableQuantity q, int isurf ) const { - IntArray dl, sn = this->getGeometryInterpolation().boundarySurfaceGiveNodes(isurf); + /** @brief Returns element code numbers of the unknowns associated with given boundary entity. + * @param answer + * @param q + * @param isurf + */ + virtual void getSurfaceElementCodeNumbers (IntArray& answer, const Variable::VariableQuantity q, int isurf ) const { + IntArray dl, sn = this->getGeometryInterpolation().boundarySurfaceGiveNodes(isurf, this->giveGeometryType()); answer.resize(0); for (int i : sn) { this->getDofManLocalCodeNumbers(dl, q, i); answer.followedBy(dl); } } - */ + virtual void getEdgeElementCodeNumbers (IntArray& answer, const Variable::VariableQuantity q, int isurf ) const { + IntArray dl, sn = this->getGeometryInterpolation().boundaryEdgeGiveNodes(isurf, this->giveGeometryType()); + answer.resize(0); + for (int i : sn) { + this->getDofManLocalCodeNumbers(dl, q, i); + answer.followedBy(dl); + } + } + + /** + * Returns boundary entity unknown vector + * @param ibc boundary entity ID + * @param bt boundary type ('s' for surface, 'e' for edge) + */ + virtual void getBoundaryUnknownVector(FloatArray& answer, const Variable& field, ValueModeType mode, int ibc, char bt, TimeStep* tStep) { + FloatArray uloc; + IntArray bNodes, dofs=field.getDofManDofIDs(); + answer.clear(); + if (bt == 's') { + bNodes = this->giveBoundarySurfaceNodes(ibc); + } else { + bNodes = this->giveBoundaryEdgeNodes(ibc); + } + for (int i : bNodes) { + this->giveDofManager(i)->giveUnknownVector(uloc, dofs, mode, tStep); + answer.append(uloc); + } + } /// @brief Assembles the partial element contribution into local element matrix /// @param answer @@ -353,12 +383,17 @@ class MPElement : public Element { return 0; } IntArray giveBoundarySurfaceNodes(int boundary) const override { - return this->getGeometryInterpolation().boundarySurfaceGiveNodes(boundary); + return this->getGeometryInterpolation().boundarySurfaceGiveNodes(boundary, this->giveGeometryType()); } IntArray giveBoundaryEdgeNodes(int boundary) const override { - return this->getGeometryInterpolation().boundaryEdgeGiveNodes(boundary); + return this->getGeometryInterpolation().boundaryEdgeGiveNodes(boundary, this->giveGeometryType()); + } + virtual void giveCharacteristicMatrixFromBC(FloatMatrix &answer, CharType type, TimeStep *tStep, GeneralBoundaryCondition *bc, int boundaryID) { + answer.clear(); + } + virtual void giveCharacteristicVectorFromBC(FloatArray &answer, CharType type, ValueModeType mode, TimeStep *tStep, GeneralBoundaryCondition *bc, int boundaryID) { + answer.clear(); } - }; diff --git a/src/mpm/mpmproblem.C b/src/mpm/mpmproblem.C index 99d858173..24c411e99 100644 --- a/src/mpm/mpmproblem.C +++ b/src/mpm/mpmproblem.C @@ -49,6 +49,7 @@ #include "nrsolver.h" #include "activebc.h" #include "boundarycondition.h" +#include "boundaryload.h" #include "outputmanager.h" #include "mpm.h" @@ -122,6 +123,109 @@ void UPResidualAssembler :: vectorFromElement(FloatArray &vec, Element &element, } +TMLhsAssembler :: TMLhsAssembler(double alpha, double deltaT) : + MatrixAssembler(), alpha(alpha), deltaT(deltaT) +{} + + +void TMLhsAssembler :: matrixFromElement(FloatMatrix &answer, Element &el, TimeStep *tStep) const +{ + FloatMatrix contrib; + IntArray locu, loct; + MPElement *e = dynamic_cast(&el); + int ndofs = e->giveNumberOfDofs(); + answer.resize(ndofs, ndofs); + answer.zero(); + + e->getLocalCodeNumbers (locu, Variable::VariableQuantity::Displacement); + e->getLocalCodeNumbers (loct, Variable::VariableQuantity::Temperature); + + e->giveCharacteristicMatrix(contrib, MomentumBalance_StiffnessMatrix, tStep); + contrib.times(this->alpha); + answer.assemble(contrib, locu, locu); + e->giveCharacteristicMatrix(contrib, MomentumBalance_ThermalCouplingMatrix, tStep); + contrib.times(this->alpha); + answer.assemble(contrib, locu, loct); + + e->giveCharacteristicMatrix(contrib, EnergyBalance_ConductivityMatrix, tStep); + contrib.times(this->alpha); + answer.assemble(contrib, loct, loct); + e->giveCharacteristicMatrix(contrib, EnergyBalance_CapacityMatrix, tStep); + contrib.times(1/tStep->giveTimeIncrement()); + answer.assemble(contrib, loct, loct); + + // @bp: experimental: evaluate element load linearization as part of residual + // note: extend bctracker to track bc applied via sets and directly on elements! + // node: ideally all external load assembled using term concept as part of residual vector! (including nodes) + // this would allow for consistent assembly of linearized terms as well. + BCTracker *bct = el.giveDomain()->giveBCTracker(); + BCTracker::entryListType bcList = bct->getElementRecords(el.giveNumber()); + // loop over all boundary conditions applied to the element + for (BCTracker::entryListType::iterator it = bcList.begin(); it != bcList.end(); ++it) { + BoundaryLoad *bc = dynamic_cast(el.giveDomain()->giveBc((*it).bcNumber)); + int boundaryID = (*it).boundaryId; + if (bc) { + if (bc->giveType() == ConvectionBC) { + e->giveCharacteristicMatrixFromBC(contrib, EnergyBalance_ConvectionBCMatrix, tStep, bc, boundaryID); + if(contrib.isNotEmpty()) { + contrib.times(this->alpha); + if (bc->giveBCGeoType() == bcGeomType::SurfaceLoadBGT) { + e->getSurfaceElementCodeNumbers(loct, Variable::VariableQuantity::Temperature, boundaryID); + } else { + e->getEdgeElementCodeNumbers(loct, Variable::VariableQuantity::Temperature, boundaryID); + } + answer.assemble(contrib, loct, loct); + } + } + } + + } + +} + +void TMResidualAssembler :: vectorFromElement(FloatArray &vec, Element &element, TimeStep *tStep, ValueModeType mode) const +{ + FloatArray contrib; + IntArray locu, loct; + MPElement *e = dynamic_cast(&element); + int ndofs = e->giveNumberOfDofs(); + vec.resize(ndofs); + vec.zero(); + + e->getLocalCodeNumbers (locu, Variable::VariableQuantity::Displacement); + e->getLocalCodeNumbers (loct, Variable::VariableQuantity::Temperature); + + e->giveCharacteristicVector(contrib, MomentumBalance_StressResidual, mode, tStep); + vec.assemble(contrib, locu); + + e->giveCharacteristicVector(contrib, EnergyBalance_Residual, mode, tStep); + vec.assemble(contrib, loct); + + BCTracker *bct = e->giveDomain()->giveBCTracker(); + BCTracker::entryListType bcList = bct->getElementRecords(element.giveNumber()); + // loop over all boundary conditions applied to the element + for (BCTracker::entryListType::iterator it = bcList.begin(); it != bcList.end(); ++it) { + BoundaryLoad *bc = dynamic_cast(element.giveDomain()->giveBc((*it).bcNumber)); + int boundaryID = (*it).boundaryId; + if (bc) { + if (bc->giveType() == ConvectionBC) { + e->giveCharacteristicVectorFromBC(contrib, EnergyBalance_ConvectionBCResidual, mode, tStep, bc, boundaryID); + if(contrib.isNotEmpty()) { + if (bc->giveBCGeoType() == bcGeomType::SurfaceLoadBGT) { + e->getSurfaceElementCodeNumbers(loct, Variable::VariableQuantity::Temperature, boundaryID); + } else { + e->getEdgeElementCodeNumbers(loct, Variable::VariableQuantity::Temperature, boundaryID); + } + vec.assemble(contrib, loct); + } + } + } + + } + +} + + MPMProblem :: MPMProblem(int i, EngngModel *_master = nullptr) : EngngModel(i, _master) { @@ -164,7 +268,7 @@ MPMProblem :: initializeFrom(InputRecord &ir) IR_GIVE_FIELD(ir, alpha, _IFT_MPMProblem_alpha); problemType = "up"; // compatibility mode @TODO Remove default value IR_GIVE_OPTIONAL_FIELD(ir, problemType, _IFT_MPMProblem_problemType); - if (!(problemType == "up")) { + if (!((problemType == "up")||(problemType == "tm"))) { throw ValueInputException(ir, "none", "Problem type not recognized"); } OOFEM_LOG_RELEVANT("MPM: %s formulation\n", problemType.c_str()); @@ -321,6 +425,8 @@ MPMProblem :: updateInternalRHS(FloatArray &answer, TimeStep *tStep, Domain *d, answer.zero(); if (this->problemType == "up") { this->assembleVector(answer, tStep, UPResidualAssembler(this->alpha, tStep->giveTimeIncrement()), VM_Total, EModelDefaultEquationNumbering(), d, eNorm); + } else if (this->problemType == "tm") { + this->assembleVector(answer, tStep, TMResidualAssembler(this->alpha, tStep->giveTimeIncrement()), VM_Total, EModelDefaultEquationNumbering(), d, eNorm); } else { OOFEM_ERROR ("unsupported problemType"); } @@ -339,6 +445,11 @@ MPMProblem :: updateMatrix(SparseMtrx &mat, TimeStep *tStep, Domain *d) //Assembling left hand side this->assemble( *effectiveMatrix, tStep, jacobianAssembler, EModelDefaultEquationNumbering(), d ); + } else if (this->problemType == "tm") { + TMLhsAssembler jacobianAssembler(this->alpha, tStep->giveTimeIncrement()); + //Assembling left hand side + this->assemble( *effectiveMatrix, tStep, jacobianAssembler, + EModelDefaultEquationNumbering(), d ); } else { OOFEM_ERROR ("unsupported problemType"); } @@ -362,6 +473,10 @@ MPMProblem :: updateComponent(TimeStep *tStep, NumericalCmpn cmpn, Domain *d) this->internalForces.zero(); if (this->problemType == "up") { this->assembleVector(this->internalForces, tStep, UPResidualAssembler(this->alpha, tStep->giveTimeIncrement()), VM_Total, EModelDefaultEquationNumbering(), d, &eNorm); + } else if (this->problemType == "tm") { + this->assembleVector(this->internalForces, tStep, TMResidualAssembler(this->alpha, tStep->giveTimeIncrement()), VM_Total, EModelDefaultEquationNumbering(), d, &eNorm); + } else { + OOFEM_ERROR ("unsupported problemType"); } this->updateSharedDofManagers(this->internalForces, EModelDefaultEquationNumbering(), InternalForcesExchangeTag); } else if ( cmpn == NonLinearLhs ) { @@ -373,7 +488,14 @@ MPMProblem :: updateComponent(TimeStep *tStep, NumericalCmpn cmpn, Domain *d) //Assembling left hand side this->assemble( *effectiveMatrix, tStep, jacobianAssembler, EModelDefaultEquationNumbering(), d ); - } + } else if (this->problemType == "tm") { + TMLhsAssembler jacobianAssembler(this->alpha, tStep->giveTimeIncrement()); + //Assembling left hand side + this->assemble( *effectiveMatrix, tStep, jacobianAssembler, + EModelDefaultEquationNumbering(), d ); + } else { + OOFEM_ERROR ("unsupported problemType"); + } this->hasTangent = true; } } else { @@ -578,6 +700,8 @@ FieldPtr MPMProblem::giveField(FieldType key, TimeStep *tStep) return std::make_shared( key, this->field.get(), IntArray{D_u, D_v, D_w} ); } else if ( key == FT_Pressure ) { return std::make_shared( key, this->field.get(), IntArray{P_f} ); + } else if ( key == FT_Temperature ) { + return std::make_shared( key, this->field.get(), IntArray{T_f} ); } else { return FieldPtr(); } diff --git a/src/mpm/mpmproblem.h b/src/mpm/mpmproblem.h index 2af6aaf5d..19c1e7125 100644 --- a/src/mpm/mpmproblem.h +++ b/src/mpm/mpmproblem.h @@ -86,6 +86,34 @@ class UPResidualAssembler : public VectorAssembler void vectorFromElement(FloatArray &vec, Element &element, TimeStep *tStep, ValueModeType mode) const override; }; +/** + * Callback class for assembling mid point effective tangents. + * @todo Need to parametrize individual contributing terms, ther locations and multilication factors. + */ +class TMLhsAssembler : public MatrixAssembler +{ +protected: + double alpha; + double deltaT; + +public: + TMLhsAssembler(double alpha, double deltaT); + void matrixFromElement(FloatMatrix &mat, Element &element, TimeStep *tStep) const override; +}; + +/** + * Callback class for assembling residuals + */ +class TMResidualAssembler : public VectorAssembler +{ + protected: + double alpha; + double deltaT; +public: + TMResidualAssembler(double alpha, double deltaT) : VectorAssembler(), alpha(alpha), deltaT(deltaT) {} + void vectorFromElement(FloatArray &vec, Element &element, TimeStep *tStep, ValueModeType mode) const override; +}; + /** diff --git a/src/mpm/prototype.C b/src/mpm/prototype.C index 26a051fde..99091287d 100644 --- a/src/mpm/prototype.C +++ b/src/mpm/prototype.C @@ -140,6 +140,8 @@ class PoissonElement : public MPElement { const char *giveInputRecordName() const override {return "pe";} const FEInterpolation& getGeometryInterpolation() const override {return this->interpol;} + Element_Geometry_Type giveGeometryType() const override {return EGT_triangle_1;} + }; REGISTER_Element(PoissonElement) diff --git a/src/mpm/prototype2.C b/src/mpm/prototype2.C new file mode 100644 index 000000000..2d90dc5e0 --- /dev/null +++ b/src/mpm/prototype2.C @@ -0,0 +1,23 @@ +#include "engngm.h" +#include "sparselinsystemnm.h" +#include "sparsenonlinsystemnm.h" +#include "sparsemtrx.h" +#include "primaryfield.h" +#include "function.h" +#include "dofdistributedprimaryfield.h" +#include "unknownnumberingscheme.h" +#include "integral.h" +#include "fei2dquadlin.h" +#include "termlibrary.h" +#include "crosssection.h" +#include "material.h" +#include "masterdof.h" +#include "gaussintegrationrule.h" +#include "prototype2.h" + +namespace oofem { + REGISTER_EngngModel(TestProblem); + REGISTER_Element(Q1Element) + REGISTER_Element(L1Element) + +} // end namespace oofem diff --git a/src/mpm/prototype2.h b/src/mpm/prototype2.h new file mode 100644 index 000000000..fe0e7a21c --- /dev/null +++ b/src/mpm/prototype2.h @@ -0,0 +1,497 @@ + +#ifndef prototype2_h +#define prototype2_h + +#include "engngm.h" +#include "sparselinsystemnm.h" +#include "sparsenonlinsystemnm.h" +#include "sparsemtrx.h" +#include "primaryfield.h" +#include "function.h" +#include "dofdistributedprimaryfield.h" +#include "unknownnumberingscheme.h" +#include "integral.h" +#include "fei2dquadlin.h" +#include "fei2dlinelin.h" +#include "termlibrary.h" +#include "crosssection.h" +#include "material.h" +#include "masterdof.h" +#include "gaussintegrationrule.h" + +///@name Input fields for testproblem +//@{ +#define _IFT_TestProblem_Name "test" +//@} + +namespace oofem { + + class LinearInterpolation : public FEInterpolation { + private: + FEI2dQuadLin fei2dQuadLin; + FEI2dLineLin fei2dLineLin; + public: + LinearInterpolation () : FEInterpolation(1), fei2dQuadLin(1,2), fei2dLineLin(1,2) {} + + virtual integrationDomain giveIntegrationDomain(const Element_Geometry_Type egt) const override { + if (egt == EGT_quad_1) return _Square; + else if (egt == EGT_line_1) return _Line; + else return _UnknownIntegrationDomain; + } + virtual const Element_Geometry_Type giveGeometryType() const override { + return EGT_unknown; + } + void giveCellDofMans(IntArray& nodes, IntArray& internalDofMans, Element* elem) const override { + return this->getCellInterpolation(elem->giveGeometryType())->giveCellDofMans(nodes,internalDofMans, elem ); + } + void evalN(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override { + return this->getCellInterpolation(cellgeo.giveGeometryType())->evalN(answer, lcoords, cellgeo); + } + double evaldNdx(FloatMatrix &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override { + return this->getCellInterpolation(cellgeo.giveGeometryType())->evaldNdx(answer, lcoords, cellgeo); + } + void local2global(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override { + return this->getCellInterpolation(cellgeo.giveGeometryType())->local2global(answer, lcoords, cellgeo); + } + virtual int global2local(FloatArray &answer, const FloatArray &gcoords, const FEICellGeometry &cellgeo) const override { + return this->getCellInterpolation(cellgeo.giveGeometryType())->global2local(answer, gcoords, cellgeo); + } + double giveTransformationJacobian(const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override { + return this->getCellInterpolation(cellgeo.giveGeometryType())->giveTransformationJacobian(lcoords, cellgeo); + } + void giveJacobianMatrixAt(FloatMatrix &jacobianMatrix, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override { + return this->getCellInterpolation(cellgeo.giveGeometryType())->giveJacobianMatrixAt(jacobianMatrix, lcoords, cellgeo ); + } + std::unique_ptr giveIntegrationRule(int order, Element_Geometry_Type egt) const override { + return this->getCellInterpolation(egt)->giveIntegrationRule(order, egt); + } + virtual void boundaryEdgeEvalN(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override { + return this->getCellInterpolation(cellgeo.giveGeometryType())->boundaryEdgeEvalN (answer, boundary, lcoords, cellgeo); + } + double boundaryEdgeEvalNormal(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override { + return this->getCellInterpolation(cellgeo.giveGeometryType())->boundaryEdgeEvalNormal(answer, boundary, lcoords, cellgeo); + } + double boundaryEdgeGiveTransformationJacobian(int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override { + return this->getCellInterpolation(cellgeo.giveGeometryType())->boundaryEdgeGiveTransformationJacobian(boundary, lcoords, cellgeo); + } + void boundaryEdgeLocal2Global(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override { + return this->getCellInterpolation(cellgeo.giveGeometryType())->boundaryEdgeLocal2Global(answer, boundary, lcoords, cellgeo); + } + integrationDomain giveBoundaryEdgeIntegrationDomain(int boundary, Element_Geometry_Type egt) const override { + return this->getCellInterpolation(egt)->giveBoundaryEdgeIntegrationDomain(boundary, egt); + } + std::unique_ptr giveBoundaryEdgeIntegrationRule(int order, int boundary, Element_Geometry_Type egt) const override { + return this->getCellInterpolation(egt)->giveBoundaryEdgeIntegrationRule(order, boundary, egt); + } + IntArray boundaryEdgeGiveNodes(int boundary, Element_Geometry_Type gt) const override { + return this->getCellInterpolation(gt)->boundaryEdgeGiveNodes(boundary, gt); + } + + void boundarySurfaceEvalN(FloatArray &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override { + return this->getCellInterpolation(cellgeo.giveGeometryType())->boundarySurfaceEvalN(answer, isurf, lcoords, cellgeo); + } + void boundarySurfaceEvaldNdx(FloatMatrix &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override { + return this->getCellInterpolation(cellgeo.giveGeometryType())->boundarySurfaceEvaldNdx(answer, isurf, lcoords, cellgeo); + } + double boundarySurfaceEvalNormal(FloatArray &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override { + return this->getCellInterpolation(cellgeo.giveGeometryType())->boundarySurfaceEvalNormal(answer, isurf, lcoords, cellgeo); + } + + void boundarySurfaceLocal2global(FloatArray &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override { + return this->getCellInterpolation(cellgeo.giveGeometryType())->boundarySurfaceLocal2global(answer, isurf, lcoords, cellgeo); + } + double boundarySurfaceGiveTransformationJacobian(int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override { + return this->getCellInterpolation(cellgeo.giveGeometryType())->boundarySurfaceGiveTransformationJacobian(isurf, lcoords, cellgeo); + } + integrationDomain giveBoundarySurfaceIntegrationDomain(int boundary, const Element_Geometry_Type egt) const override { + return this->getCellInterpolation(egt)->giveBoundarySurfaceIntegrationDomain(boundary, egt); + } + std::unique_ptr giveBoundarySurfaceIntegrationRule(int order, int boundary, const Element_Geometry_Type egt) const override { + return this->getCellInterpolation(egt)->giveBoundarySurfaceIntegrationRule(order, boundary, egt) ; + } + IntArray boundarySurfaceGiveNodes(int boundary, const Element_Geometry_Type gt) const override { + return this->getCellInterpolation(gt)->boundarySurfaceGiveNodes(boundary, gt); + } + + IntArray boundaryGiveNodes(int boundary, const Element_Geometry_Type gt) const override { + return this->getCellInterpolation(gt)->boundaryGiveNodes(boundary, gt); + } + void boundaryEvalN(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override { + return this->getCellInterpolation(cellgeo.giveGeometryType())->boundaryEvalN(answer, boundary, lcoords, cellgeo); + } + double boundaryEvalNormal(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override { + return this->getCellInterpolation(cellgeo.giveGeometryType())->boundaryEvalNormal(answer, boundary, lcoords, cellgeo); + } + double boundaryGiveTransformationJacobian(int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override { + return this->getCellInterpolation(cellgeo.giveGeometryType())->boundaryGiveTransformationJacobian(boundary, lcoords, cellgeo); + } + void boundaryLocal2Global(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override { + return this->getCellInterpolation(cellgeo.giveGeometryType())->boundaryLocal2Global(answer, boundary, lcoords, cellgeo); + } + integrationDomain giveBoundaryIntegrationDomain(int boundary, Element_Geometry_Type egt) const override { + return this->getCellInterpolation(egt)->giveBoundaryIntegrationDomain(boundary,egt); + } + std::unique_ptr giveBoundaryIntegrationRule(int order, int boundary, Element_Geometry_Type egt) const override { + return this->getCellInterpolation(egt)->giveBoundaryIntegrationRule(order, boundary, egt); + } + int giveKnotSpanBasisFuncMask(const IntArray &knotSpan, IntArray &mask) const override{ return 0; } + int giveNumberOfKnotSpanBasisFunctions(const IntArray &knotSpan) const override { return 0; } + bool hasSubPatchFormulation() const override { return false; } + const FloatArray *giveKnotVector() const override { return nullptr; } + int giveNumberOfKnotSpans(int dim) const override { return 0; } + const FloatArray *giveKnotValues(int dim) const override{ return nullptr; } + const IntArray *giveKnotMultiplicity(int dim) const override{ return nullptr; } + int giveNsd(const Element_Geometry_Type egt) const override { + if (egt == EGT_quad_1) return 2; + else if (egt == EGT_line_1) return 1; + else return 0; + } + int giveNumberOfEdges(Element_Geometry_Type gt) const override + { + return this->getCellInterpolation(gt)->giveNumberOfEdges(gt); + } + int giveNumberOfNodes(Element_Geometry_Type gt) const override + { + return this->getCellInterpolation(gt)-> giveNumberOfNodes(gt); + } + + const FEInterpolation* getCellInterpolation (Element_Geometry_Type egt) const { + if (egt==EGT_quad_1) return &fei2dQuadLin; + else if (egt == EGT_line_1) return &fei2dLineLin; + else return NULL; + } + }; + + + class MPMSymbolicTerm : public Term { + public: + MPMSymbolicTerm (const Variable &testField, const Variable& unknownField, MaterialMode m) : Term(testField, unknownField, m) {}; + void initializeCell(Element& cell) const override { + // allocate necessary DOFs + IntArray enodes, einteranlnodes, dofIDs; + // process term field + dofIDs = this->field.getDofManDofIDs(); + this->field.interpolation.giveCellDofMans(enodes, einteranlnodes, &cell); + for (auto i: enodes) { + DofManager* dman = cell.giveDofManager(i); + for (auto d: dofIDs) { + if (!dman->hasDofID((DofIDItem) d)) { + // create a DOF + MasterDof* dof = new MasterDof(dman, (DofIDItem)d); + dman->appendDof(dof); + } + } + } + for (auto i: einteranlnodes) { + DofManager* dman = cell.giveInternalDofManager(i); + for (auto d: dofIDs) { + if (!dman->hasDofID((DofIDItem) d)) { + // create a DOF + MasterDof* dof = new MasterDof(dman, (DofIDItem)d); + dman->appendDof(dof); + } + } + } + // process testField + dofIDs = this->testField.getDofManDofIDs(); + this->testField.interpolation.giveCellDofMans(enodes, einteranlnodes, &cell); + for (auto i: enodes) { + DofManager* dman = cell.giveDofManager(i); + for (auto d: dofIDs) { + if (!dman->hasDofID((DofIDItem)d)) { + // create a DOF + MasterDof* dof = new MasterDof(dman, (DofIDItem)d); + dman->appendDof(dof); + } + } + } + for (auto i: einteranlnodes) { + DofManager* dman = cell.giveInternalDofManager(i); + for (auto d: dofIDs) { + if (!dman->hasDofID((DofIDItem)d)) { + // create a DOF + MasterDof* dof = new MasterDof(dman, (DofIDItem)d); + dman->appendDof(dof); + } + } + } + // set up the integration rule on cell + // get required number of IPs + int myorder = this->field.interpolation.giveInterpolationOrder() * this->testField.interpolation.giveInterpolationOrder(); + GaussIntegrationRule ir(0, &cell); + int nip = ir.getRequiredNumberOfIntegrationPoints(cell.giveIntegrationDomain(), myorder); + // create nd insert it toelement if not exist yet. + std::vector< std :: unique_ptr< IntegrationRule > > &irvec = cell.giveIntegrationRulesArray(); + bool found = false; + int size = irvec.size(); + for (int i = 0; i< size; i++) { + if (irvec[i].get()->giveNumberOfIntegrationPoints() == nip) { + found = true; + break; + } + } + if (!found) { + // need to insert right one + irvec.resize( size +1); + irvec [ size] = std::make_unique(size, &cell); + //irvec [ size ]->SetUpPointsOnSquare(nip, this->mode); + irvec[size]->setUpIntegrationPoints(cell.giveIntegrationDomain(), nip, this->mode); + } + } + IntegrationRule* giveElementIntegrationRule(Element* e) const override { + int myorder = this->field.interpolation.giveInterpolationOrder() * this->testField.interpolation.giveInterpolationOrder(); + GaussIntegrationRule ir(0, e); + int nip = ir.getRequiredNumberOfIntegrationPoints(e->giveIntegrationDomain(), myorder); + std::vector< std :: unique_ptr< IntegrationRule > > &irvec = e->giveIntegrationRulesArray(); + int size = irvec.size(); + for (int i = 0; i< size; i++) { + if (irvec[i].get()->giveNumberOfIntegrationPoints() == nip) { + return irvec[i].get(); + } + } + return NULL; + } + }; + + class BTSigmaTerm2 : public MPMSymbolicTerm { + protected: + public: + BTSigmaTerm2 (const Variable &testField, const Variable& unknownField, MaterialMode m) : MPMSymbolicTerm(testField, unknownField, m) {}; + + /** + * @brief Evaluates the linearization of $B^T\sigma(u)$, i.e. $B^TDBu$ + * + * @param answer + * @param e + * @param coords + */ + void evaluate_lin (FloatMatrix& answer, MPElement& e, GaussPoint* gp, TimeStep* tstep) const override { + FloatMatrix D, B, DB; + e.giveCrossSection()->giveMaterial(gp)->giveCharacteristicMatrix(D, TangentStiffness, gp, tstep); + this->grad(B, this->field, this->field.interpolation, e, gp->giveNaturalCoordinates(), gp->giveMaterialMode()); + DB.beProductOf(D, B); + //answer.plusProductSymmUpper(B, DB, 1.0); + answer.beTProductOf(B,DB); + } + /** + * @brief Evaluates Internal forces vector, i.e. $b^T\sigma(u)$ + * + * @param cell + * @param coords + */ + void evaluate (FloatArray& answer, MPElement& cell, GaussPoint* gp, TimeStep* tstep) const override { + FloatArray u, eps, sig; + FloatMatrix B; + cell.getUnknownVector(u, this->field, VM_TotalIntrinsic, tstep); + this->grad(B, this->field, this->field.interpolation, cell, gp->giveNaturalCoordinates(), gp->giveMaterialMode()); + eps.beProductOf(B, u); + cell.giveCrossSection()->giveMaterial(gp)->giveCharacteristicVector(sig, eps, Stress, gp, tstep); + answer.beTProductOf(B, sig); + } + void getDimensions(Element& cell) const override {} + + protected: + /** + * @brief Evaluates B matrix; i.e. $LN$ where $L$ is operator matrix and $N$ is interpolation matrix of unknowns + * + * @param answer B matrix + * @param v + * @param interpol + * @param cell + * @param coords + */ + void grad(FloatMatrix& answer, const Variable &v, const FEInterpolation& interpol, const Element& cell, const FloatArray& coords, const MaterialMode mmode) const { + FloatMatrix dndx; + int nnodes = interpol.giveNumberOfNodes(cell.giveGeometryType()); + int ndofs = v.size; + // evaluate matrix of derivatives, the member at i,j position contains value of dNi/dxj + interpol.evaldNdx(dndx, coords, FEIElementGeometryWrapper(&cell)); + + if ((mmode == _3dUP) || (mmode == _3dUPV) || (mode==_3dMat)) { + // 3D mode only now + answer.resize(6, nnodes*ndofs); + for (int i = 0; i< nnodes; i++) { + answer(0, i*ndofs+0) = dndx(i, 0); + answer(1, i*ndofs+1) = dndx(i, 1); + answer(2, i*ndofs+2) = dndx(i, 2); + + answer(3, i*ndofs+1) = dndx(i, 2); + answer(3, i*ndofs+2) = dndx(i, 1); + + answer(4, i*ndofs+0) = dndx(i, 2); + answer(4, i*ndofs+2) = dndx(i, 0); + + answer(5, i*ndofs+0) = dndx(i, 1); + answer(5, i*ndofs+1) = dndx(i, 0); + } + } else if ((mmode == _2dUP) || (mmode == _2dUPV)) { + answer.resize(6, nnodes*ndofs); + for (int i = 0; i< nnodes; i++) { + answer(0, i*ndofs+0) = dndx(i, 0); + answer(1, i*ndofs+1) = dndx(i, 1); + + answer(5, i*ndofs+0) = dndx(i, 1); + answer(5, i*ndofs+1) = dndx(i, 0); + } + } else if ((mmode == _PlaneStress)) { + answer.resize(3, nnodes*ndofs); + for (int i = 0; i< nnodes; i++) { + answer(0, i*ndofs+0) = dndx(i, 0); + answer(1, i*ndofs+1) = dndx(i, 1); + + answer(2, i*ndofs+0) = dndx(i, 1); + answer(2, i*ndofs+1) = dndx(i, 0); + } + } + } + + }; + + + class NTfTerm : public MPMSymbolicTerm { + protected: + public: + NTfTerm (const Variable &testField, const Variable& unknownField, MaterialMode m) : MPMSymbolicTerm(testField, unknownField, m) {}; + + void evaluate_lin (FloatMatrix& answer, MPElement& e, GaussPoint* gp, TimeStep* tstep) const override {} + + /** + * @brief Evaluates the residual contribution (rhs) + * + * @param answer + * @param e + * @param coords + */ + void evaluate (FloatArray& answer, MPElement& e, GaussPoint* gp, TimeStep* tstep) const override { + FloatMatrix N; + FloatArray nvec, flux={1.,0.}; + const FloatArray& lc = gp->giveNaturalCoordinates(); + + this->testField.interpolation.evalN(nvec, lc, FEIElementGeometryWrapper(&e)); + N.beNMatrixOf(nvec, testField.size); + answer.beTProductOf(N, flux); + } + + void getDimensions(Element& cell) const override {} + }; + + + + class TestProblem : public EngngModel + { + protected: + SparseMtrxType sparseMtrxType = SMT_Skyline; + std :: unique_ptr< DofDistributedPrimaryField > field; + + std :: unique_ptr< SparseMtrx > effectiveMatrix; + + FloatArray solution; + FloatArray internalForces; + FloatArray eNorm; + + /// Numerical method used to solve the problem + std :: unique_ptr< SparseLinearSystemNM > nMethod; + + public: + TestProblem(int i, EngngModel * _master) : EngngModel(i, _master) { ndomains = 1;} + + + void solveYourselfAt(TimeStep *tStep) override { + Domain *domain = this->giveDomain(1); + Set myset (1, domain); + FEI2dQuadLin interpol(1,2); + Variable u = Variable(interpol, Variable::VariableQuantity::Displacement, Variable::VariableType::vector, 2, NULL, {1,2}); + BTSigmaTerm2 mt(u,u, _2dUP); + myset.setElementList({1}); + this->integralList.push_back(std::make_unique(domain, myset, mt)); + Integral *i = this->integralList[0].get(); + i->initialize(); + + this->forceEquationNumbering(); + OOFEM_LOG_DEBUG("Number of equations %d\n", this->giveNumberOfDomainEquations( 1, EModelDefaultEquationNumbering()) ); + + if ( !effectiveMatrix ) { + effectiveMatrix = classFactory.createSparseMtrx(sparseMtrxType); + effectiveMatrix->buildInternalStructure( this, 1, EModelDefaultEquationNumbering() ); + } + i->assemble_lhs (*effectiveMatrix, EModelDefaultEquationNumbering(), tStep); + effectiveMatrix->printYourself(); + } + + TimeStep *giveNextStep() override + { + if ( !currentStep ) { + // first step -> generate initial step + //currentStep = std::make_unique(*giveSolutionStepWhenIcApply()); + currentStep = std::make_unique(giveNumberOfTimeStepWhenIcApply(), this, 1, 0., 1., 0); + } + previousStep = std :: move(currentStep); + currentStep = std::make_unique(*previousStep, 1.); + + return currentStep.get(); + } + + // identification + const char *giveInputRecordName() const { return _IFT_TestProblem_Name; } + const char *giveClassName() const override { return "TestProblem"; } + fMode giveFormulation() override { return TL; } + }; + + + + class Q1Element : public MPElement { + protected: + const static FEInterpolation & gInterpol; + public: + Q1Element (int n, Domain* d): MPElement(n,d) { + numberOfDofMans = 4; + } + const char *giveInputRecordName() const override {return "Q1";} + const char *giveClassName() const override {return "Q1";} + const FEInterpolation& getGeometryInterpolation() const override {return this->gInterpol;} + + Element_Geometry_Type giveGeometryType() const override { + return EGT_quad_1; + } + // MPElement requirements + void getDofManLocalCodeNumbers (IntArray& answer, const Variable::VariableQuantity q, int num ) const override {} + void getInternalDofManLocalCodeNumbers (IntArray& answer, const Variable::VariableQuantity q, int num ) const override {} + int getNumberOfSurfaceDOFs() const override {return 0;} + int getNumberOfEdgeDOFs() const override {return 0;} + void getSurfaceLocalCodeNumbers(IntArray& answer, const Variable::VariableQuantity q) const override {} + void getEdgeLocalCodeNumbers(IntArray& answer, const Variable::VariableQuantity q) const override {} + + }; + const FEInterpolation & Q1Element::gInterpol = FEI2dQuadLin(1,2); + #define _IFT_Q1Element_Name "q1" + + class L1Element : public MPElement { + protected: + const static FEInterpolation & gInterpol; + public: + L1Element (int n, Domain* d): MPElement(n,d) { + numberOfDofMans = 2; + } + const char *giveInputRecordName() const override {return "L1";} + const char *giveClassName() const override {return "L1";} + const FEInterpolation& getGeometryInterpolation() const override { + return this->gInterpol; + } + + Element_Geometry_Type giveGeometryType() const override { + return EGT_line_1; + } + // MPElement requirements + void getDofManLocalCodeNumbers (IntArray& answer, const Variable::VariableQuantity q, int num ) const override {} + void getInternalDofManLocalCodeNumbers (IntArray& answer, const Variable::VariableQuantity q, int num ) const override {} + int getNumberOfSurfaceDOFs() const override {return 0;} + int getNumberOfEdgeDOFs() const override {return 0;} + void getSurfaceLocalCodeNumbers(IntArray& answer, const Variable::VariableQuantity q) const override {} + void getEdgeLocalCodeNumbers(IntArray& answer, const Variable::VariableQuantity q) const override {} + + }; + const FEInterpolation & L1Element::gInterpol = FEI2dLineLin(1,2); + #define _IFT_L1Element_Name "l1" + +} // end namespace oofem +#endif // prototype2_h \ No newline at end of file diff --git a/src/mpm/termlibrary.C b/src/mpm/termlibrary.C index 3e4c68606..a370bb1c2 100644 --- a/src/mpm/termlibrary.C +++ b/src/mpm/termlibrary.C @@ -45,7 +45,7 @@ BTSigTerm::BTSigTerm (const Variable &testField, const Variable& unknownField) : void BTSigTerm::evaluate_lin (FloatMatrix& answer, MPElement& e, GaussPoint* gp, TimeStep* tstep) const { FloatMatrix D, B, DB; - e.giveCrossSection()->giveMaterial(gp)->giveCharacteristicMatrix(D, StiffnessMatrix, gp, tstep); + e.giveCrossSection()->giveMaterial(gp)->giveCharacteristicMatrix(D, TangentStiffness, gp, tstep); this->grad(B, this->field, this->field.interpolation, e, gp->giveNaturalCoordinates(), gp->giveMaterialMode()); DB.beProductOf(D, B); //answer.plusProductSymmUpper(B, DB, 1.0); @@ -58,7 +58,7 @@ void BTSigTerm::evaluate (FloatArray& answer, MPElement& cell, GaussPoint* gp, T cell.getUnknownVector(u, this->field, VM_TotalIntrinsic, tstep); this->grad(B, this->field, this->field.interpolation, cell, gp->giveNaturalCoordinates(), gp->giveMaterialMode()); eps.beProductOf(B, u); - cell.giveCrossSection()->giveMaterial(gp)->giveCharacteristicVector(sig, eps, InternalForcesVector, gp, tstep); + cell.giveCrossSection()->giveMaterial(gp)->giveCharacteristicVector(sig, eps, Stress, gp, tstep); answer.beTProductOf(B, sig); } @@ -71,12 +71,12 @@ void BTSigTerm::initializeCell(Element& cell) const {} void BTSigTerm::grad(FloatMatrix& answer, const Variable &v, const FEInterpolation& interpol, const Element& cell, const FloatArray& coords, const MaterialMode mmode) const { FloatMatrix dndx; - int nnodes = interpol.giveNumberOfNodes(); + int nnodes = interpol.giveNumberOfNodes(cell.giveGeometryType()); int ndofs = v.size; // evaluate matrix of derivatives, the member at i,j position contains value of dNi/dxj interpol.evaldNdx(dndx, coords, FEIElementGeometryWrapper(&cell)); - if ((mmode == _3dUP) || (mmode == _3dUPV)) { + if ((mmode == _3dMat)|| (mmode == _3dUP) || (mmode == _3dUPV)) { // 3D mode only now answer.resize(6, nnodes*ndofs); for (int i = 0; i< nnodes; i++) { @@ -108,12 +108,12 @@ void BTSigTerm::grad(FloatMatrix& answer, const Variable &v, const FEInterpolati //wTgNTfTerm class (H) -gNTfTerm::gNTfTerm (const Variable &testField, const Variable& unknownField) : Term(testField, unknownField) {} +gNTfTerm::gNTfTerm (const Variable &testField, const Variable& unknownField, MatResponseMode lhst, MatResponseMode rtype) : Term(testField, unknownField), lhsType(lhst), rhsType(rtype) {} void gNTfTerm::evaluate_lin (FloatMatrix& answer, MPElement& e, GaussPoint* gp, TimeStep* tstep) const { FloatMatrix D, B, DB; - e.giveCrossSection()->giveMaterial(gp)->giveCharacteristicMatrix(D, PermeabilityMatrix, gp, tstep); // update + e.giveCrossSection()->giveMaterial(gp)->giveCharacteristicMatrix(D, lhsType, gp, tstep); // update this->grad(B, this->field, this->field.interpolation, e, gp->giveNaturalCoordinates()); DB.beProductOf(D, B); answer.beTProductOf(B, DB); @@ -125,7 +125,7 @@ void gNTfTerm::evaluate (FloatArray& answer, MPElement& cell, GaussPoint* gp, Ti cell.getUnknownVector(p, this->field, VM_TotalIntrinsic, tstep); this->grad(B, this->field, this->field.interpolation, cell, gp->giveNaturalCoordinates()); gradp.beProductOf(B, p); - cell.giveCrossSection()->giveMaterial(gp)->giveCharacteristicVector(fp, gradp, FluidMassBalancePressureContribution, gp, tstep); // update + cell.giveCrossSection()->giveMaterial(gp)->giveCharacteristicVector(fp, gradp, rhsType, gp, tstep); // update answer.beTProductOf(B, fp); } @@ -174,7 +174,7 @@ void BTamNTerm::initializeCell(Element& cell) const {} void BTamNTerm::grad(FloatMatrix& answer, const Variable &v, const FEInterpolation& interpol, const Element& cell, const FloatArray& coords, const MaterialMode mmode) const { FloatMatrix dndx; - int nnodes = interpol.giveNumberOfNodes(); + int nnodes = interpol.giveNumberOfNodes(cell.giveGeometryType()); int ndofs = v.size; // evaluate matrix of derivatives, the member at i,j position contains value of dNi/dxj interpol.evaldNdx(dndx, coords, FEIElementGeometryWrapper(&cell)); @@ -240,7 +240,7 @@ void NTamTBTerm::initializeCell(Element& cell) const {} void NTamTBTerm::grad(FloatMatrix& answer, const Variable &v, const FEInterpolation& interpol, const Element& cell, const FloatArray& coords, const MaterialMode mmode) const { FloatMatrix dndx; - int nnodes = interpol.giveNumberOfNodes(); + int nnodes = interpol.giveNumberOfNodes(cell.giveGeometryType()); int ndofs = v.size; // evaluate matrix of derivatives, the member at i,j position contains value of dNi/dxj interpol.evaldNdx(dndx, coords, FEIElementGeometryWrapper(&cell)); @@ -277,13 +277,13 @@ void NTamTBTerm::grad(FloatMatrix& answer, const Variable &v, const FEInterpolat // NTcN Term (S(dp/dt)) -NTcN::NTcN (const Variable &testField, const Variable& unknownField) : Term(testField, unknownField) {} +NTcN::NTcN (const Variable &testField, const Variable& unknownField, MatResponseMode ctype) : Term(testField, unknownField), ctype(ctype) {} void NTcN::evaluate_lin (FloatMatrix& answer, MPElement& e, GaussPoint* gp, TimeStep* tstep) const { FloatArray Np; this->field.interpolation.evalN(Np, gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(&e)); answer.beDyadicProductOf(Np, Np); - answer.times(e.giveCrossSection()->giveMaterial(gp)->giveCharacteristicValue(CompressibilityCoefficient, gp, tstep)); + answer.times(e.giveCrossSection()->giveMaterial(gp)->giveCharacteristicValue(ctype, gp, tstep)); } void NTcN::evaluate (FloatArray& answer, MPElement& cell, GaussPoint* gp, TimeStep* tstep) const { @@ -336,4 +336,22 @@ NTf_Edge::evaluate (FloatArray& answer, MPElement& cell, GaussPoint* gp, TimeSte } +// A external flux term $S=(N)^T f$, where $f$ is functor evaluating the flux. +NTf_Body::NTf_Body (const Variable &testField, const NTfFunctor& f) : Term (testField, testField), f(f) {} + +void +NTf_Body::evaluate (FloatArray& answer, MPElement& cell, GaussPoint* gp, TimeStep* tStep) const { + FloatArray nvec, flux; + FloatMatrix N; + const FloatArray& lc = gp->giveNaturalCoordinates(); + + this->f.evaluate(flux, lc, cell, this->testField, tStep); + + this->testField.interpolation.evalN(nvec, lc, FEIElementGeometryWrapper(&cell)); + N.beNMatrixOf(nvec, testField.size); + answer.beTProductOf(N, flux); + +} + + } // end namespace oofem diff --git a/src/mpm/termlibrary.h b/src/mpm/termlibrary.h index 1bf7e8f1a..b13c86937 100644 --- a/src/mpm/termlibrary.h +++ b/src/mpm/termlibrary.h @@ -36,6 +36,7 @@ #include "mpm.h" #include "boundaryload.h" +#include "bodyload.h" namespace oofem { /** @@ -84,8 +85,9 @@ class BTSigTerm : public Term { */ class gNTfTerm : public Term { protected: + MatResponseMode lhsType, rhsType; public: - gNTfTerm (const Variable &testField, const Variable& unknownField) ; + gNTfTerm (const Variable &testField, const Variable& unknownField, MatResponseMode lhsType, MatResponseMode rhsType) ; /** * @brief Evaluates $\bf{H}$ matrix, the linearization of $w^T(\grad N)^T f(p)$, i.e. $(\grad N)^T \bf{k}/\mu \grad p = \bf{H}$ @@ -205,8 +207,9 @@ class NTamTBTerm : public Term { */ class NTcN : public Term { protected: + MatResponseMode ctype; public: - NTcN (const Variable &testField, const Variable& unknownField) ; + NTcN (const Variable &testField, const Variable& unknownField, MatResponseMode ctype) ; /** * @brief Evaluates the linearization of term (the lhs contribution) @@ -273,6 +276,36 @@ class BoundaryFluxFunctor: public NTfFunctor { } }; +class BodyFluxFunctor: public NTfFunctor { + protected: + BodyLoad *load; + IntArray dofIDs; + public: + BodyFluxFunctor(BodyLoad *load, const IntArray& dofIDs) : load(load), dofIDs(dofIDs) {} + + void evaluate(FloatArray& answer, const FloatArray& lcoords, MPElement& cell, const Variable &testField, TimeStep* tStep) const override { + + ValueModeType mode = VM_Total; + if ( load->giveFormulationType() == Load :: FT_Entity ) { + load->computeValues(answer, tStep, lcoords, dofIDs, mode); + } else { + FloatArray globalIPcoords; + testField.interpolation.local2global(globalIPcoords, lcoords, FEIElementGeometryWrapper(&cell) ); + load->computeValues(answer, tStep, globalIPcoords, dofIDs, mode); + } + + ///@todo Make sure this part is correct. + // We always want the global values in the end, so we might as well compute them here directly: + // transform force + if ( load->giveCoordSystMode() == Load :: CST_Global ) { + // then just keep it in global c.s + } else { + OOFEM_ERROR("Body load in local coordinate system not supported yet.") + } + } +}; + + /** * @brief A external flux term $S=(N)^T f$, where $f$ is functor evaluating the flux. */ @@ -333,6 +366,34 @@ class NTf_Edge : public Term { }; +/** + * @brief A external flux term $S=(N)^T f$, where $f$ is functor evaluating the flux. + */ +class NTf_Body : public Term { + protected: + const NTfFunctor& f; + public: + NTf_Body (const Variable &testField, const NTfFunctor& f) ; + + /** + * @brief Evaluates the linearization of term (the lhs contribution) + * + * @param answer + * @param e + * @param coords + */ + void evaluate_lin (FloatMatrix& answer, MPElement& e, GaussPoint* gp, TimeStep* tstep) const override {} + /** + * @brief Evaluates Internal forces vector, i.e. $w^T(\grad N)^T f(p)$ + * + * @param cell + * @param coords + */ + void evaluate (FloatArray&, MPElement& cell, GaussPoint* gp, TimeStep* tstep) const override ; + void getDimensions(Element& cell) const override {} + void initializeCell(Element& cell) const override {} + +}; } // end namespace oofem #endif // termlibrary_h diff --git a/src/mpm/termlibrary2.C b/src/mpm/termlibrary2.C index eec4fde4c..08e5e73a9 100644 --- a/src/mpm/termlibrary2.C +++ b/src/mpm/termlibrary2.C @@ -43,7 +43,7 @@ namespace oofem { void deltaB(FloatMatrix& answer, const Variable &v, const FEInterpolation& interpol, const Element& cell, const FloatArray& coords, const MaterialMode mmode) { FloatMatrix dndx; - int nnodes = interpol.giveNumberOfNodes(); + int nnodes = interpol.giveNumberOfNodes(cell.giveGeometryType()); int ndofs = v.size; // evaluate matrix of derivatives, the member at i,j position contains value of dNi/dxj interpol.evaldNdx(dndx, coords, FEIElementGeometryWrapper(&cell)); @@ -68,13 +68,13 @@ void deltaB(FloatMatrix& answer, const Variable &v, const FEInterpolation& inter void evalB(FloatMatrix& answer, const Variable &v, const FEInterpolation& interpol, const Element& cell, const FloatArray& coords, const MaterialMode mmode) { FloatMatrix dndx; - int nnodes = interpol.giveNumberOfNodes(); + int nnodes = interpol.giveNumberOfNodes(cell.giveGeometryType()); int ndofs = v.size; // evaluate matrix of derivatives, the member at i,j position contains value of dNi/dxj interpol.evaldNdx(dndx, coords, FEIElementGeometryWrapper(&cell)); answer.resize(6, nnodes*ndofs); answer.zero(); - if (mmode == _3dUPV) { + if ((mmode == _3dUPV)||(mmode == _3dMat)) { // 3D mode for (int i = 0; i< nnodes; i++) { answer(0, i*ndofs+0) = dndx(i, 0); // e_11 @@ -268,7 +268,7 @@ void NTmuVfSNTerm::evaluate_lin (FloatMatrix& answer, MPElement& e, GaussPoint* this->field.interpolation.evalN(N, gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(&e)); Nd.beNMatrixOf (N, testField.size); - e.giveCrossSection()->giveMaterial(gp)->giveCharacteristicMatrix(S, PermeabilityMatrix, gp, tstep); + e.giveCrossSection()->giveMaterial(gp)->giveCharacteristicMatrix(S, Permeability, gp, tstep); double m = e.giveCrossSection()->giveMaterial(gp)->giveCharacteristicValue(FluidViscosity, gp, tstep); double vf = evalVolumeFraction(this->volumeFraction, e, gp->giveNaturalCoordinates(), tstep); SI.beInverseOf(S); diff --git a/src/mpm/termlibrary3.C b/src/mpm/termlibrary3.C new file mode 100644 index 000000000..438abbf22 --- /dev/null +++ b/src/mpm/termlibrary3.C @@ -0,0 +1,211 @@ +/* + * + * ##### ##### ###### ###### ### ### + * ## ## ## ## ## ## ## ### ## + * ## ## ## ## #### #### ## # ## + * ## ## ## ## ## ## ## ## + * ## ## ## ## ## ## ## ## + * ##### ##### ## ###### ## ## + * + * + * OOFEM : Object Oriented Finite Element Code + * + * Copyright (C) 1993 - 2024 Borek Patzak + * + * + * + * Czech Technical University, Faculty of Civil Engineering, + * Department of Structural Mechanics, 166 29 Prague, Czech Republic + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "mpm.h" +#include "termlibrary3.h" +#include "termlibrary2.h" +#include "element.h" +#include "material.h" +#include "crosssection.h" + +namespace oofem { + + +TMBTSigTerm::TMBTSigTerm (const Variable &testField, const Variable& unknownField, const Variable& temperatureField) : BTSigTerm(testField, unknownField), temperatureField(temperatureField) {} + +void TMBTSigTerm::evaluate (FloatArray& answer, MPElement& cell, GaussPoint* gp, TimeStep* tstep) const { + FloatArray eps, sig; + FloatMatrix B; + this->computeTMgeneralizedStrain(eps, B, cell, gp->giveNaturalCoordinates(), gp->giveMaterialMode(), tstep); + + + cell.giveCrossSection()->giveMaterial(gp)->giveCharacteristicVector(sig, eps, MatResponseMode::Stress, gp, tstep); + answer.beTProductOf(B, sig); +} + +void TMBTSigTerm::computeTMgeneralizedStrain (FloatArray& answer, FloatMatrix& B, MPElement& cell, const FloatArray& lcoords, MaterialMode mmode, TimeStep* tstep) const { + FloatArray u, gradT; + FloatMatrix dndx ; + answer.resize(0); + cell.getUnknownVector(u, this->field, VM_TotalIntrinsic, tstep); + this->grad(B, this->field, this->field.interpolation, cell, lcoords, mmode); + answer.beProductOf(B, u); + + FloatArray rt, Nt; + cell.getUnknownVector(rt, temperatureField, VM_TotalIntrinsic, tstep); + // evaluate matrix of derivatives, the member at i,j position contains value of dNi/dxj + this->temperatureField.interpolation.evaldNdx(dndx, lcoords, FEIElementGeometryWrapper(&cell)); + // evaluate temperature gradient at given point + gradT.beTProductOf(dndx, rt); + // evaluate temperature at given point + this->temperatureField.interpolation.evalN(Nt, lcoords, FEIElementGeometryWrapper(&cell)); + double t = Nt.dotProduct(rt); + answer.append(gradT); // construct generalized strain vector + answer.append(t); // add temperature +} + +TMgNTfTerm::TMgNTfTerm (const Variable &testField, const Variable& unknownField, MatResponseMode lhsType, MatResponseMode rhsType) : gNTfTerm(testField, unknownField, lhsType, rhsType) {} +void TMgNTfTerm::evaluate (FloatArray& answer, MPElement& cell, GaussPoint* gp, TimeStep* tstep) const { + FloatArray sv(10), Nt, p, gradp, fp; + FloatMatrix B; + cell.getUnknownVector(p, this->field, VM_TotalIntrinsic, tstep); + this->grad(B, this->field, this->field.interpolation, cell, gp->giveNaturalCoordinates()); + this->field.interpolation.evalN(Nt, gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(&cell)); + double t = Nt.dotProduct(p); + gradp.beProductOf(B, p); + sv(6) = gradp(0); + sv(7) = gradp(1); + sv(8) = gradp(2); + sv(9) = t; + cell.giveCrossSection()->giveMaterial(gp)->giveCharacteristicVector(fp, sv, rhsType, gp, tstep); // update + answer.beTProductOf(B, fp); +} + + + +BDalphaPiTerm::BDalphaPiTerm (const Variable &testField, const Variable& unknownField, ValueModeType m) : Term(testField, unknownField), m(m) {} + + +void BDalphaPiTerm::evaluate_lin (FloatMatrix& answer, MPElement& e, GaussPoint* gp, TimeStep* tstep) const { + FloatMatrix D, alphaPi, B, DaPI, BDaPI; + FloatArray Nt; + // alphaPi term + e.giveCrossSection()->giveMaterial(gp)->giveCharacteristicMatrix(D, Conductivity, gp, tstep); // 3x3 in 3D + // expand it + alphaPi.resize(6,1); + alphaPi.zero(); + alphaPi(0,0) = -D(0,0); + alphaPi(1,0) = -D(1,1); + alphaPi(2,0) = -D(2,2); + e.giveCrossSection()->giveMaterial(gp)->giveCharacteristicMatrix(D, TangentStiffness, gp, tstep); // 3x3 in 3D + evalB(B, this->testField, this->testField.interpolation, e, gp->giveNaturalCoordinates(), gp->giveMaterialMode()); + this->field.interpolation.evalN(Nt, gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(&e)); + + DaPI.beProductOf(D, alphaPi); + BDaPI.beTProductOf(B,DaPI); + FloatMatrix Ntm(Nt, true); + answer.beProductOf(BDaPI,Ntm); + +} + +void BDalphaPiTerm::evaluate (FloatArray& answer, MPElement& cell, GaussPoint* gp, TimeStep* tstep) const { + // this is a partial linearization of BtSigma term with respect to temperature + // thus the residual (rhs) contribution should come from BtSigma term + answer.resize(this->testField.interpolation.giveNumberOfNodes(cell.giveGeometryType())*this->testField.size); + answer.zero(); +} + +void BDalphaPiTerm::getDimensions(Element& cell) const {} +void BDalphaPiTerm::initializeCell(Element& cell) const {} + + +BTdSigmadT::BTdSigmadT (const Variable &testField, const Variable& unknownField) : Term(testField, unknownField) {} + + +void BTdSigmadT::evaluate_lin (FloatMatrix& answer, MPElement& e, GaussPoint* gp, TimeStep* tstep) const { + FloatMatrix D, B, DB; + FloatArray Nt; + // aplhaPi term + e.giveCrossSection()->giveMaterial(gp)->giveCharacteristicMatrix(D, DSigmaDT, gp, tstep); + this->field.interpolation.evalN(Nt, gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(&e)); + evalB(B, this->testField, this->testField.interpolation, e, gp->giveNaturalCoordinates(), gp->giveMaterialMode()); + FloatMatrix Ntm(Nt, true); + DB.beProductOf(D, Ntm); + //answer.plusProductSymmUpper(B, DB, 1.0); + answer.beTProductOf(B,DB); +} + +void BTdSigmadT::evaluate (FloatArray& answer, MPElement& cell, GaussPoint* gp, TimeStep* tstep) const { + // this is a partial linearization of BtSigma term with respect to temperature + // thus the residual (rhs) contribution should come from BtSigma term + answer.resize(this->testField.interpolation.giveNumberOfNodes(cell.giveGeometryType())*this->testField.size); + answer.zero(); +} + +void BTdSigmadT::getDimensions(Element& cell) const {} +void BTdSigmadT::initializeCell(Element& cell) const {} + + +NTaTmTe:: NTaTmTe (const Variable &testField, const Variable& unknownField, BoundaryLoad* _bl, int bid, char btype) : Term(testField, unknownField), bl(_bl), boundaryID(bid), boundaryType(btype) {}; +void NTaTmTe::evaluate_lin (FloatMatrix& answer, MPElement& e, GaussPoint* gp, TimeStep* tstep) const { + FloatArray Nt; + if (boundaryType == 's') { + this->testField.interpolation.boundarySurfaceEvalN(Nt, boundaryID, gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(&e)); + } else { + this->testField.interpolation.boundaryEdgeEvalN(Nt, boundaryID, gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(&e)); + } + answer.resize(Nt.giveSize(), Nt.giveSize()); + answer.zero(); + answer.plusDyadUnsym(Nt, Nt, this->bl->giveProperty('a', tstep)); +} + +void NTaTmTe::evaluate (FloatArray& answer, MPElement& e, GaussPoint* gp, TimeStep* tstep) const { + FloatArray Nt, rt, Te, coords; + if (boundaryType == 's') { + this->testField.interpolation.boundarySurfaceEvalN(Nt, boundaryID, gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(&e)); + } else { + this->testField.interpolation.boundaryEdgeEvalN(Nt, boundaryID, gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(&e)); + } + // get surface unknown vector + + e.getBoundaryUnknownVector(rt, this->field, VM_TotalIntrinsic, this->boundaryID, this->boundaryType, tstep); + double t = Nt.dotProduct(rt); + answer= Nt; + if ( this->bl->giveFormulationType() == Load :: FT_Entity ) { + coords = gp->giveNaturalCoordinates(); + } else { + //this->computeSurfIpGlobalCoords(gcoords, gp->giveNaturalCoordinates(), iSurf); + e.getGeometryInterpolation().boundarySurfaceLocal2global(coords, this->boundaryID, gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(&e)); + } + this->bl->computeValues(Te, tstep, coords, this->field.dofIDs, VM_TotalIntrinsic); + answer *= this->bl->giveProperty('a', tstep)*(t-Te.at(1)); +} + +void NTaTmTe::getDimensions(Element& cell) const {} +void NTaTmTe::initializeCell(Element& cell) const {} + +InternalTMFluxSourceTerm::InternalTMFluxSourceTerm (const Variable &testField, const Variable& unknownField, const Variable& temperatureField) : TMBTSigTerm(testField, unknownField, temperatureField) {} + +void InternalTMFluxSourceTerm::evaluate (FloatArray& answer, MPElement& cell, GaussPoint* gp, TimeStep* tstep) const { + FloatArray eps, n, f; + FloatMatrix B, N; + this->computeTMgeneralizedStrain(eps, B, cell, gp->giveNaturalCoordinates(), gp->giveMaterialMode(), tstep); + cell.giveCrossSection()->giveMaterial(gp)->giveCharacteristicVector(f, eps, MatResponseMode::IntSource, gp, tstep); + this->testField.interpolation.evalN(n, gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(&cell)); + N.beNMatrixOf(n, testField.size); + answer.beTProductOf(N, f); +} + + +} // end namespace oofem diff --git a/src/mpm/termlibrary3.h b/src/mpm/termlibrary3.h new file mode 100644 index 000000000..4a5060869 --- /dev/null +++ b/src/mpm/termlibrary3.h @@ -0,0 +1,184 @@ +/* + * + * ##### ##### ###### ###### ### ### + * ## ## ## ## ## ## ## ### ## + * ## ## ## ## #### #### ## # ## + * ## ## ## ## ## ## ## ## + * ## ## ## ## ## ## ## ## + * ##### ##### ## ###### ## ## + * + * + * OOFEM : Object Oriented Finite Element Code + * + * Copyright (C) 1993 - 2024 Borek Patzak + * + * + * + * Czech Technical University, Faculty of Civil Engineering, + * Department of Structural Mechanics, 166 29 Prague, Czech Republic + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ +#ifndef termlibrary3_h +#define termlibrary3_h + +#include "mpm.h" +#include "boundaryload.h" +#include "termlibrary.h" + +// file containing various term definitions + +namespace oofem { + + /** + * @brief A Linear momentum balance equation term ($B^T\sigma(u)$) + * + */ +class TMBTSigTerm : public BTSigTerm { + protected: + const Variable& temperatureField; + public: + TMBTSigTerm (const Variable &testField, const Variable& unknownField, const Variable& temperatureField) ; + /** + * @brief Evaluates Internal forces vector, i.e. $b^T\sigma(u)$ + * + * @param cell + * @param coords + */ + void evaluate (FloatArray&, MPElement& cell, GaussPoint* gp, TimeStep* tstep) const override; + void computeTMgeneralizedStrain (FloatArray& answer, FloatMatrix&B, MPElement& cell, const FloatArray& lcoords, MaterialMode mmode, TimeStep* tstep) const; +}; +/** + * @brief momentum balance term (lhs only) (\int (\partial N)^T D (-\alpha\Pi)) + * + */ +class BDalphaPiTerm : public Term { + protected: + ValueModeType m; + public: + BDalphaPiTerm (const Variable &testField, const Variable& unknownField, ValueModeType m) ; + + /** + * @brief Evaluates the linearization of $B^T\sigma(u)$, i.e. $B^TDBu$ + * + * @param answer + * @param e + * @param coords + */ + void evaluate_lin (FloatMatrix& answer, MPElement& e, GaussPoint* gp, TimeStep* tstep) const override; + /** + * @brief Empty, this should be evaluated by BTSigTerm term$ + * + * @param cell + * @param coords + */ + void evaluate (FloatArray&, MPElement& cell, GaussPoint* gp, TimeStep* tstep) const override; + void getDimensions(Element& cell) const override; + void initializeCell(Element& cell) const override; + + protected: + +}; + +class TMgNTfTerm : public gNTfTerm { + protected: + public: + TMgNTfTerm (const Variable &testField, const Variable& unknownField, MatResponseMode lhsType, MatResponseMode rhsType) ; + + + /** + * @brief Evaluates Internal forces vector, i.e. $w^T(\grad N)^T f(p)$ + * + * @param cell + * @param coords + */ + void evaluate (FloatArray&, MPElement& cell, GaussPoint* gp, TimeStep* tstep) const override; + +}; + + +/// @brief evaluates lhs of ∫(𝐵𝑢)𝑇(𝑑𝜎(𝜀,𝑇)/𝑑𝑇) +class BTdSigmadT : public Term { + protected: + public: + BTdSigmadT (const Variable &testField, const Variable& unknownField) ; + + /** + * @brief Evaluates the linearization of $B^T\sigma(u)$, i.e. $B^TDBu$ + * + * @param answer + * @param e + * @param coords + */ + void evaluate_lin (FloatMatrix& answer, MPElement& e, GaussPoint* gp, TimeStep* tstep) const override; + /** + * @brief Evaluates Internal forces vector, i.e. $b^T\sigma(u)$ + * + * @param cell + * @param coords + */ + void evaluate (FloatArray&, MPElement& cell, GaussPoint* gp, TimeStep* tstep) const override; + void getDimensions(Element& cell) const override; + void initializeCell(Element& cell) const override; + +}; + + +/// @brief evaluates flux due to convection BC ∫(Nt)a(T-Te)ds, Te being external temperature and a being convective heat transfer coefficient +class NTaTmTe : public Term { + protected: + BoundaryLoad* bl; + int boundaryID; + char boundaryType; + public: + NTaTmTe (const Variable &testField, const Variable& unknownField, BoundaryLoad* bl, int boundaryID, char boundaryType) ; + + /** + * @brief Evaluates the linearization of $B^T\sigma(u)$, i.e. $B^TDBu$ + * + * @param answer + * @param e + * @param coords + */ + void evaluate_lin (FloatMatrix& answer, MPElement& e, GaussPoint* gp, TimeStep* tstep) const override; + /** + * @brief Evaluates Internal forces vector, i.e. $b^T\sigma(u)$ + * + * @param cell + * @param coords + */ + void evaluate (FloatArray&, MPElement& cell, GaussPoint* gp, TimeStep* tstep) const override; + void getDimensions(Element& cell) const override; + void initializeCell(Element& cell) const override; +}; + + +class InternalTMFluxSourceTerm : public TMBTSigTerm { + protected: + public: + InternalTMFluxSourceTerm (const Variable &testField, const Variable& unknownField, const Variable& temperatureField) ; + /** + * @brief Evaluates Internal forces vector, i.e. $b^T\sigma(u)$ + * + * @param cell + * @param coords + */ + void evaluate (FloatArray&, MPElement& cell, GaussPoint* gp, TimeStep* tstep) const override; +}; + + + +} // end namespace oofem +#endif // termlibrary_h diff --git a/src/mpm/tm.C b/src/mpm/tm.C new file mode 100644 index 000000000..94263de90 --- /dev/null +++ b/src/mpm/tm.C @@ -0,0 +1,718 @@ +/* + * + * ##### ##### ###### ###### ### ### + * ## ## ## ## ## ## ## ### ## + * ## ## ## ## #### #### ## # ## + * ## ## ## ## ## ## ## ## + * ## ## ## ## ## ## ## ## + * ##### ##### ## ###### ## ## + * + * + * OOFEM : Object Oriented Finite Element Code + * + * Copyright (C) 1993 - 2024 Borek Patzak + * + * + * + * Czech Technical University, Faculty of Civil Engineering, + * Department of Structural Mechanics, 166 29 Prague, Czech Republic + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + + +#include "mpm.h" +#include "termlibrary3.h" +#include "termlibrary.h" +#include "element.h" +#include "gausspoint.h" +#include "feinterpol.h" +#include "intarray.h" +#include "classfactory.h" +#include "gaussintegrationrule.h" + +#include "fei3dtetlin.h" +#include "fei3dtetquad.h" +#include "fei3dhexalin.h" +#include "fei2dquadlin.h" +#include "mathfem.h" + +#include "material.h" +#include "matstatus.h" + +#include "boundaryload.h" +#include "bodyload.h" +#include "zznodalrecoverymodel.h" + +namespace oofem { + + +/** + * @brief Base class for fully coupled, nonlinear thermo mechanical elements + * + */ +class TMElement : public MPElement { + + private: + virtual int giveNumberOfUDofs() const = 0; + virtual int giveNumberOfTDofs() const = 0; + virtual const Variable& getU() const = 0; + virtual const Variable& getT() const = 0; + + public: + TMElement(int n, Domain* d): + MPElement(n,d) { } + + // Note: performance can be probably improved once it will be possible + // to directly assemble multiple term contributions to the system matrix. + // template metaprogramming? + void giveCharacteristicMatrix(FloatMatrix &answer, CharType type, TimeStep *tStep) override { + IntegrationRule* ir = this->giveDefaultIntegrationRulePtr(); + + if (type == MomentumBalance_StiffnessMatrix) { + int udofs = this->giveNumberOfUDofs(); + answer.resize(udofs,udofs); + answer.zero(); + this->integrateTerm_dw (answer, TMBTSigTerm (getU(),getU(), getT()), ir, tStep) ; + } else if (type == MomentumBalance_ThermalCouplingMatrix) { + int udofs = this->giveNumberOfUDofs(); + int tdofs = this->giveNumberOfTDofs(); + answer.resize(udofs,tdofs); + answer.zero(); + this->integrateTerm_dw (answer, BDalphaPiTerm (getU(),getT(), VM_TotalIntrinsic), ir, tStep) ; + this->integrateTerm_dw (answer, BTdSigmadT(getU(),getT()), ir, tStep) ; + } else if (type == EnergyBalance_ConductivityMatrix) { + int tdofs = this->giveNumberOfTDofs(); + answer.resize(tdofs,tdofs); + answer.zero(); + this->integrateTerm_dw (answer, TMgNTfTerm(getT(),getT(), Conductivity, Flux), ir, tStep) ; + } else if (type == EnergyBalance_CapacityMatrix) { + int tdofs = this->giveNumberOfTDofs(); + answer.resize(tdofs,tdofs); + answer.zero(); + this->integrateTerm_dw (answer, NTcN(getT(), getT(), Capacity), ir, tStep) ; + } else { + OOFEM_ERROR("Unknown characteristic matrix type"); + } + } + + void giveCharacteristicVector(FloatArray &answer, CharType type, ValueModeType mode, TimeStep *tStep) override { + IntegrationRule* ir = this->giveDefaultIntegrationRulePtr(); + if (type == MomentumBalance_StressResidual) { + answer.resize(this->giveNumberOfUDofs()); + answer.zero(); + this->integrateTerm_c (answer, TMBTSigTerm(getU(),getU(),getT()), ir, tStep) ; + } else if (type == EnergyBalance_Residual) { + answer.resize(this->giveNumberOfTDofs()); + answer.zero(); + this->integrateTerm_c(answer, TMgNTfTerm(getT(),getT(), Conductivity, Flux), ir, tStep) ; + answer.times(-1.0); + this->integrateTerm_c (answer, NTcN(getT(), getT(), Capacity), ir, tStep) ; + // add internal (material generated) heat source r(T) to the residual + FloatArray temp; + this->integrateTerm_c(temp, InternalTMFluxSourceTerm(getT(),getU(),getT()), ir, tStep); + answer.subtract(temp); + } else if (type == ExternalForcesVector) { + answer.zero(); + } else { + OOFEM_ERROR("Unknown characteristic vector type"); + } + } + + void giveCharacteristicMatrixFromBC(FloatMatrix &answer, CharType type, TimeStep *tStep, GeneralBoundaryCondition *bc, int boundaryID) override { + if (bc->giveType() == ConvectionBC) { + BoundaryLoad *bbc = dynamic_cast(bc); + if (bbc) { + FloatMatrix contrib; + IntArray loc; + int iorder = getU().interpolation.giveInterpolationOrder()+bbc->giveApproxOrder(); + std::unique_ptr ir; + answer.clear(); + if (bbc->giveBCGeoType() == bcGeomType::SurfaceLoadBGT) { + ir = this->getGeometryInterpolation().giveBoundarySurfaceIntegrationRule(iorder, 1, this->giveGeometryType()); + //this->integrateSurfaceTerm_dw(contrib, NTf_Surface(getT(), BoundaryFluxFunctor(bbc, boundaryID, getT().dofIDs,'s'), boundaryID), ir.get(), boundaryID, tStep); + this->integrateSurfaceTerm_dw(answer, NTaTmTe(getT(), getT(), bbc, boundaryID, 's'), ir.get(), boundaryID, tStep); + } else if (bbc->giveBCGeoType() == bcGeomType::EdgeLoadBGT) { + ir = this->getGeometryInterpolation().giveBoundaryEdgeIntegrationRule(iorder, 1, this->giveGeometryType()); + //this->integrateSurfaceTerm_dw(contrib, NTf_Surface(getT(), BoundaryFluxFunctor(bbc, boundaryID, getT().dofIDs,'e'), boundaryID), ir.get(), boundaryID, tStep); + this->integrateSurfaceTerm_dw(answer, NTaTmTe(getT(), getT(), bbc, boundaryID, 'e'), ir.get(), boundaryID, tStep); + } else { + OOFEM_ERROR("Unsupported boundary condition geometry type"); + } + } + } else { + answer.clear(); + } + } + + + virtual void giveCharacteristicVectorFromBC(FloatArray &answer, CharType type, ValueModeType mode, TimeStep *tStep, GeneralBoundaryCondition *bc, int boundaryID) override { + + if ((type == EnergyBalance_ConvectionBCResidual) && (bc->giveType() == ConvectionBC)) { + BoundaryLoad *bl = dynamic_cast(bc); + IntArray loct, tc; + FloatArray contrib2; + answer.clear(); + int o = getT().interpolation.giveInterpolationOrder()+bl->giveApproxOrder(); + if (bc->giveBCGeoType() == bcGeomType::SurfaceLoadBGT) { + std::unique_ptr ir2 = this->getGeometryInterpolation().giveBoundarySurfaceIntegrationRule(o, boundaryID, this->giveGeometryType()); + this->integrateSurfaceTerm_c(answer, NTaTmTe(getT(), getT(), bl, boundaryID, 's'), ir2.get(), boundaryID, tStep); + } else { + std::unique_ptr ir2 = this->getGeometryInterpolation().giveBoundaryEdgeIntegrationRule(o, boundaryID, this->giveGeometryType()); + this->integrateEdgeTerm_c(answer, NTaTmTe(getT(), getT(), bl, boundaryID, 'e'), ir2.get(), boundaryID, tStep); + } + } else { + answer.clear(); + } + + } + + void computeBoundarySurfaceLoadVector(FloatArray &answer, BoundaryLoad *load, int boundary, CharType type, ValueModeType mode, TimeStep *tStep, bool global = true) override { + answer.resize(this->getNumberOfSurfaceDOFs()); + answer.zero(); + + if ( type != ExternalForcesVector ) { + return; + } + + bcType bct = load->giveType(); + if (bct == TransmissionBC ) { + + IntArray locu, loct; + FloatArray contrib, contrib2; + getSurfaceLocalCodeNumbers (locu, Variable::VariableQuantity::Displacement) ; + getSurfaceLocalCodeNumbers (loct, Variable::VariableQuantity::Temperature) ; + + // integrate traction contribution (momentum balance) + int o = getU().interpolation.giveInterpolationOrder()+load->giveApproxOrder(); + std::unique_ptr ir = this->getGeometryInterpolation().giveBoundarySurfaceIntegrationRule(o, boundary, this->giveGeometryType()); + this->integrateSurfaceTerm_c(contrib, NTf_Surface(getU(), BoundaryFluxFunctor(load, boundary, getU().dofIDs, 's'), boundary), ir.get(), boundary, tStep); + answer.assemble(contrib, locu); + + // integrate mass (fluid) flux normal to the boundary (mass balance) + o = getT().interpolation.giveInterpolationOrder()+load->giveApproxOrder(); + std::unique_ptr ir2 = this->getGeometryInterpolation().giveBoundarySurfaceIntegrationRule(o, boundary, this->giveGeometryType()); + this->integrateSurfaceTerm_c(contrib2, NTf_Surface(getT(), BoundaryFluxFunctor(load, boundary, getT().dofIDs,'s'), boundary), ir2.get(), boundary, tStep); + contrib2.times(-1.0); + answer.assemble(contrib2, loct); + + } else if (bct == ConvectionBC) { + // convection handled in residual evaluation + } else { + OOFEM_ERROR("Unsupported boundary condition type"); + } + } + + void computeBoundaryEdgeLoadVector(FloatArray &answer, BoundaryLoad *load, int boundary, CharType type, ValueModeType mode, TimeStep *tStep, bool global=true) override { + answer.resize(this->getNumberOfEdgeDOFs()); + answer.zero(); + + if ( type != ExternalForcesVector ) { + return; + } + + bcType bct = load->giveType(); + if (bct == TransmissionBC ) { + IntArray locu, loct; + FloatArray contrib, contrib2; + getEdgeLocalCodeNumbers (locu, Variable::VariableQuantity::Displacement) ; + getEdgeLocalCodeNumbers (loct, Variable::VariableQuantity::Pressure) ; + + // integrate traction contribution (momentum balance) + int o = getU().interpolation.giveInterpolationOrder()+load->giveApproxOrder(); + std::unique_ptr ir = this->getGeometryInterpolation().giveBoundaryEdgeIntegrationRule(o, boundary, this->giveGeometryType()); + this->integrateEdgeTerm_c(contrib, NTf_Edge(getU(), BoundaryFluxFunctor(load, boundary, getU().dofIDs,'e'), boundary), ir.get(), boundary, tStep); + answer.assemble(contrib, locu); + + // integrate mass (fluid) flux normal to the boundary (mass balance) + o = getT().interpolation.giveInterpolationOrder()+load->giveApproxOrder(); + std::unique_ptr ir2 = this->getGeometryInterpolation().giveBoundaryEdgeIntegrationRule(o, boundary, this->giveGeometryType()); + this->integrateEdgeTerm_c(contrib2, NTf_Edge(getT(), BoundaryFluxFunctor(load, boundary, getT().dofIDs,'e'), boundary), ir2.get(), boundary, tStep); + contrib2.times(-1.0); + answer.assemble(contrib2, loct); + } else if (bct == ConvectionBC) { + // convection handled in residual evaluation + } else { + OOFEM_ERROR("Unsupported boundary condition type"); + } + } + + void computeLoadVector(FloatArray &answer, BodyLoad *load, CharType type, ValueModeType mode, TimeStep *tStep) override { + answer.resize(this->giveNumberOfDofs()); + answer.zero(); + if (type == ExternalForcesVector) { + if (load->giveBCValType() == ForceLoadBVT) { + FloatArray contribu, contribt; + IntArray locu, loct; + getLocalCodeNumbers (locu, Variable::VariableQuantity::Displacement) ; + getLocalCodeNumbers (loct, Variable::VariableQuantity::Temperature) ; + this->integrateTerm_c(contribu, NTf_Body(getU(), BodyFluxFunctor(load, getU().dofIDs)), this->giveDefaultIntegrationRulePtr(), tStep); + this->integrateTerm_c(contribt, NTf_Body(getT(), BodyFluxFunctor(load, getT().dofIDs)), this->giveDefaultIntegrationRulePtr(), tStep); + answer.assemble(contribu, locu); + answer.assemble(contribt, loct); + } else { + OOFEM_ERROR("Unsupported body load type"); + } + } else { + OOFEM_ERROR("Unsupported load type"); + } + } + + + int computeFluxLBToLRotationMatrix(FloatMatrix &answer, int iSurf, const FloatArray& lc, const Variable::VariableQuantity q, char btype) override { + if (q == Variable::VariableQuantity::Displacement) { + // better to integrate this into FEInterpolation class + FloatArray nn, h1(3), h2(3); + answer.resize(3,3); + if (btype == 's') { + this->getGeometryInterpolation().boundarySurfaceEvalNormal(nn, iSurf, lc, FEIElementGeometryWrapper(this)); + } else { + OOFEM_ERROR ("Unsupported boundary entity"); + } + nn.normalize(); + for ( int i = 1; i <= 3; i++ ) { + answer.at(i, 3) = nn.at(i); + } + + // determine lcs of surface + // local x axis in xy plane + double test = fabs(fabs( nn.at(3) ) - 1.0); + if ( test < 1.e-5 ) { + h1.at(1) = answer.at(1, 1) = 1.0; + h1.at(2) = answer.at(2, 1) = 0.0; + } else { + h1.at(1) = answer.at(1, 1) = answer.at(2, 3); + h1.at(2) = answer.at(2, 1) = -answer.at(1, 3); + } + + h1.at(3) = answer.at(3, 1) = 0.0; + // local y axis perpendicular to local x,z axes + h2.beVectorProductOf(nn, h1); + for ( int i = 1; i <= 3; i++ ) { + answer.at(i, 2) = h2.at(i); + } + + return 1; + } else { + answer.clear(); + return 0; + } + } + //virtual void getLocalCodeNumbers (IntArray& answer, const Variable::VariableQuantity q ) const = 0; + //virtual void giveDofManDofIDMask(int inode, IntArray &answer) const =0; + +}; + + + +/** + * @brief 3D Equal order linear Brick TS Element + * + */ +class TMBrick11 : public TMElement, public ZZNodalRecoveryModelInterface { + protected: + //FEI3dTetLin pInterpol; + //FEI3dTetQuad uInterpol; + const static FEInterpolation & tInterpol; + const static FEInterpolation & uInterpol; + const static Variable& t; + const static Variable& u; + + public: + TMBrick11(int n, Domain* d): + TMElement(n,d), ZZNodalRecoveryModelInterface(this) + { + numberOfDofMans = 8; + numberOfGaussPoints = 8; + this->computeGaussPoints(); + } + + void getDofManLocalCodeNumbers (IntArray& answer, const Variable::VariableQuantity q, int num ) const override { + /* dof ordering: u1 v1 w1 p1 u2 v2 w2 p2 u3 v3 w3 p3 u4 v4 w4 u5 v5 w5 u6 v6 w6*/ + if (q == Variable::VariableQuantity::Displacement) { + //answer={1,2,3, 5,6,7, 9,10,11, 13,14,15, 17,18,19, 21,22,23, 25,26,27, 29,30,31 }; + int o = (num-1)*4+1; + answer={o, o+1, o+2}; + } else if (q == Variable::VariableQuantity::Temperature) { + //answer = {4, 8, 12, 16, 20, 24, 28, 32}; + answer={num*4}; + } + } + void getInternalDofManLocalCodeNumbers (IntArray& answer, const Variable::VariableQuantity q, int num ) const override { + answer={}; + } + + void giveDofManDofIDMask(int inode, IntArray &answer) const override { + answer = {1,2,3,10}; + } + int giveNumberOfDofs() override { return 32; } + const char *giveInputRecordName() const override {return "tmbrick11";} + const char *giveClassName() const override { return "TMBrick11"; } + + + const FEInterpolation& getGeometryInterpolation() const override {return this->tInterpol;} + + Element_Geometry_Type giveGeometryType() const override { + return EGT_hexa_1; + } + int getNumberOfSurfaceDOFs() const override {return 16;} + int getNumberOfEdgeDOFs() const override {return 0;} + void getSurfaceLocalCodeNumbers(IntArray& answer, const Variable::VariableQuantity q) const override { + if (q == Variable::VariableQuantity::Displacement) { + answer={1,2,3, 5,6,7, 9,10,11, 13,14,15}; + } else { + answer ={4, 8, 12, 16}; + } + } + void getEdgeLocalCodeNumbers(IntArray& answer, const Variable::VariableQuantity q) const override {} + Interface *giveInterface(InterfaceType it) override { + if (it == ZZNodalRecoveryModelInterfaceType) { + return this; + } else { + return NULL; + } + } + + + +private: + virtual int giveNumberOfUDofs() const override {return 24;} + virtual int giveNumberOfTDofs() const override {return 8;} + virtual const Variable& getU() const override {return u;} + virtual const Variable& getT() const override {return t;} + void computeGaussPoints() override { + if ( integrationRulesArray.size() == 0 ) { + integrationRulesArray.resize( 1 ); + integrationRulesArray [ 0 ] = std::make_unique(1, this); + integrationRulesArray [ 0 ]->SetUpPointsOnCube(numberOfGaussPoints, _3dMat); + } + } +}; + +const FEInterpolation & TMBrick11::uInterpol = FEI3dHexaLin(); +const FEInterpolation & TMBrick11::tInterpol = FEI3dHexaLin(); +const Variable& TMBrick11::t = Variable(TMBrick11::tInterpol, Variable::VariableQuantity::Temperature, Variable::VariableType::scalar, 1, NULL, {10}); +const Variable& TMBrick11::u = Variable(TMBrick11::uInterpol, Variable::VariableQuantity::Displacement, Variable::VariableType::vector, 3, NULL, {1,2,3}); + +#define _IFT_TMBrick11_Name "tmbrick11" +REGISTER_Element(TMBrick11) + + +/** + * @brief 3D Equal order linear Tetrahedra TS Element + * + */ +class TMTetra11 : public TMElement, public ZZNodalRecoveryModelInterface { + protected: + //FEI3dTetLin pInterpol; + //FEI3dTetQuad uInterpol; + const static FEInterpolation & tInterpol; + const static FEInterpolation & uInterpol; + const static Variable& t; + const static Variable& u; + + public: + TMTetra11(int n, Domain* d): + TMElement(n,d), ZZNodalRecoveryModelInterface(this) + { + numberOfDofMans = 4; + numberOfGaussPoints = 4; + this->computeGaussPoints(); + } + + void getDofManLocalCodeNumbers (IntArray& answer, const Variable::VariableQuantity q, int num ) const override { + /* dof ordering: u1 v1 w1 p1 u2 v2 w2 p2 u3 v3 w3 p3 u4 v4 w4 u5 v5 w5 u6 v6 w6*/ + if (q == Variable::VariableQuantity::Displacement) { + //answer={1,2,3, 5,6,7, 9,10,11, 13,14,15}; + int o = (num-1)*4+1; + answer={o, o+1, o+2}; + } else if (q == Variable::VariableQuantity::Temperature) { + //answer = {4, 8, 12, 16}; + answer={num*4}; + } + } + void getInternalDofManLocalCodeNumbers (IntArray& answer, const Variable::VariableQuantity q, int num ) const override { + answer={}; + } + + void giveDofManDofIDMask(int inode, IntArray &answer) const override { + answer = {1,2,3,10}; + } + int giveNumberOfDofs() override { return 16; } + const char *giveInputRecordName() const override {return "tmtetra11";} + const char *giveClassName() const override { return "TMTetra11"; } + + + const FEInterpolation& getGeometryInterpolation() const override {return this->tInterpol;} + + Element_Geometry_Type giveGeometryType() const override { + return EGT_tetra_1; + } + int getNumberOfSurfaceDOFs() const override {return 12;} + int getNumberOfEdgeDOFs() const override {return 0;} + void getSurfaceLocalCodeNumbers(IntArray& answer, const Variable::VariableQuantity q) const override { + if (q == Variable::VariableQuantity::Displacement) { + answer={1,2,3, 5,6,7, 9,10,11}; + } else { + answer ={4, 8, 12}; + } + } + void getEdgeLocalCodeNumbers(IntArray& answer, const Variable::VariableQuantity q) const override {} + Interface *giveInterface(InterfaceType it) override { + if (it == ZZNodalRecoveryModelInterfaceType) { + return this; + } else { + return NULL; + } + } + + + +private: + virtual int giveNumberOfUDofs() const override {return 12;} + virtual int giveNumberOfTDofs() const override {return 4;} + virtual const Variable& getU() const override {return u;} + virtual const Variable& getT() const override {return t;} + void computeGaussPoints() override { + if ( integrationRulesArray.size() == 0 ) { + integrationRulesArray.resize( 1 ); + integrationRulesArray [ 0 ] = std::make_unique(1, this); + integrationRulesArray [ 0 ]->SetUpPointsOnTetrahedra(numberOfGaussPoints, _3dMat); + } + } +}; + +const FEInterpolation & TMTetra11::uInterpol = FEI3dTetLin(); +const FEInterpolation & TMTetra11::tInterpol = FEI3dTetLin(); +const Variable& TMTetra11::t = Variable(TMTetra11::tInterpol, Variable::VariableQuantity::Temperature, Variable::VariableType::scalar, 1, NULL, {10}); +const Variable& TMTetra11::u = Variable(TMTetra11::uInterpol, Variable::VariableQuantity::Displacement, Variable::VariableType::vector, 3, NULL, {1,2,3}); + +#define _IFT_TMTetra11_Name "tmtetra11" +REGISTER_Element(TMTetra11) + + +#define _IFT_TMSimpleMaterial_Name "tmm" +#define _IFT_TMSimpleMaterial_E "e" +#define _IFT_TMSimpleMaterial_nu "nu" +#define _IFT_TMSimpleMaterial_lambda "lambda" +#define _IFT_TMSimpleMaterial_alpha "alpha" +#define _IFT_TMSimpleMaterial_c "c" + +class TMMaterialStatus : public MaterialStatus +{ +protected: + /// Equilibrated strain vector in reduced form + FloatArray strainVector; + /// Equilibrated stress vector in reduced form + FloatArray stressVector; + /// Temporary stress vector in reduced form (increments are used mainly in nonlinear analysis) + FloatArray tempStressVector; + /// Temporary strain vector in reduced form (to find balanced state) + FloatArray tempStrainVector; + /// Temporary flux + FloatArray tempFluxVector; + /// Equilibrated flux + FloatArray fluxVector; +public: + /// Constructor. Creates new StructuralMaterialStatus with IntegrationPoint g. + TMMaterialStatus (GaussPoint * g) : MaterialStatus(g), strainVector(), stressVector(), + tempStressVector(), tempStrainVector() + {} + +/// Returns the const pointer to receiver's strain vector. + const FloatArray &giveStrainVector() const { return strainVector; } + /// Returns the const pointer to receiver's stress vector. + const FloatArray &giveStressVector() const { return stressVector; } + /// Returns the const pointer to receiver's temporary strain vector. + const FloatArray &giveTempStrainVector() const { return tempStrainVector; } + /// Returns the const pointer to receiver's temporary stress vector. + const FloatArray &giveTempStressVector() const { return tempStressVector; } + /// Returns the const pointer to receiver's temporary flux vector. + const FloatArray &giveTempFluxVector() const { return tempFluxVector; } + /// Returns the const pointer to receiver's flux vector. + const FloatArray &giveFluxVector() const { return fluxVector; } + /// Assigns tempStressVector to given vector v. + void letTempStressVectorBe(const FloatArray &v) { tempStressVector = v; } + /// Assigns tempStrainVector to given vector v + void letTempStrainVectorBe(const FloatArray &v) { tempStrainVector = v; } + /// Assigns tempFluxVector to given vector v + void letTempFluxVectorBe(const FloatArray &v) { tempFluxVector = v; } + + void printOutputAt(FILE *file, TimeStep *tStep) const override { + MaterialStatus :: printOutputAt(file, tStep); + fprintf(file, " strains "); + for ( auto &var : strainVector ) { + fprintf( file, " %+.4e", var ); + } + + fprintf(file, "\n stresses"); + for ( auto &var : stressVector ) { + fprintf( file, " %+.4e", var ); + } + + fprintf(file, "\n fluxes"); + for ( auto &var : fluxVector ) { + fprintf( file, " %+.4e", var ); + } + fprintf(file, "\n"); + } + + void initTempStatus() override { + MaterialStatus :: initTempStatus(); + tempStressVector = stressVector; + tempStrainVector = strainVector; + tempFluxVector = fluxVector; + } + void updateYourself(TimeStep *tStep) override { + MaterialStatus :: updateYourself(tStep); + stressVector = tempStressVector; + strainVector = tempStrainVector; + fluxVector = tempFluxVector; + } + const char *giveClassName() const override {return "TMMaterialStatus";} + +}; + +class TMSimpleMaterial : public Material { + protected: + double e, nu; // elastic isotropic constants + double lambda; // isotropic conductivity + double alpha; // thermal expansion coefficient + double c; // thermal capacity + public: + TMSimpleMaterial (int n, Domain* d) : Material (n,d) {e=1.0; nu=0.15; lambda=1.0; alpha=1.0; c=0.1;} + + void giveCharacteristicMatrix(FloatMatrix &answer, MatResponseMode type, GaussPoint* gp, TimeStep *tStep) const override { + MaterialMode mmode = gp->giveMaterialMode(); + if (type == TangentStiffness) { + double ee; + + ee = e / ( ( 1. + nu ) * ( 1. - 2. * nu ) ); + answer.resize(6, 6); + answer.zero(); + + answer.at(1, 1) = 1. - nu; + answer.at(1, 2) = nu; + answer.at(1, 3) = nu; + answer.at(2, 1) = nu; + answer.at(2, 2) = 1. - nu; + answer.at(2, 3) = nu; + answer.at(3, 1) = nu; + answer.at(3, 2) = nu; + answer.at(3, 3) = 1. - nu; + + answer.at(4, 4) = ( 1. - 2. * nu ) * 0.5; + answer.at(5, 5) = ( 1. - 2. * nu ) * 0.5; + answer.at(6, 6) = ( 1. - 2. * nu ) * 0.5; + + answer.times(ee); + } else if (type == DSigmaDT) { + answer.resize(6,1); + answer.zero(); + } else if (type == Conductivity) { + if (mmode == _3dMat) { + answer.resize(3,3); + answer.beUnitMatrix(); + answer.times(this->lambda); + } + } else { + OOFEM_ERROR("Unknown characteristic matrix type"); + } + } + /** + * @param flux Generalized strain vector, flux.at(1-6) containing total strain vector, flux(7-9) temperature gradient, flux(10) temperature + */ + void giveCharacteristicVector(FloatArray &answer, FloatArray& flux, MatResponseMode type, GaussPoint* gp, TimeStep *tStep) const override { + TMMaterialStatus *status = static_cast< TMMaterialStatus * >( this->giveStatus(gp) ); + if (type == Stress) { + FloatMatrix d; + FloatArray eps(6); + for (int i=0; i<6; i++) { + eps(i) = flux(i); + } + double t = flux(9); + eps(0)-= t*alpha; + eps(1)-= t*alpha; + eps(2)-= t*alpha; + + this->giveCharacteristicMatrix(d, TangentStiffness, gp, tStep); + + answer.beProductOf(d, eps); + // update gp status + status->letTempStrainVectorBe(flux); + status->letTempStressVectorBe(answer); + + } else if (type == Flux) { + FloatMatrix k; + FloatArray grad(3); + this->giveCharacteristicMatrix(k, Conductivity, gp, tStep); + grad(0) = -flux(6); + grad(1) = -flux(7); + grad(2) = -flux(8); + answer.beProductOf(k, grad); + status->letTempFluxVectorBe(answer); + } else if (type == IntSource) { + answer.resize(1); + answer.zero(); + } else { + OOFEM_ERROR("Unknown characteristic vector type"); + } + } + + + double giveCharacteristicValue(MatResponseMode type, GaussPoint* gp, TimeStep *tStep) const override { + if (type == BiotConstant) { + return alpha; + } else if (type == Capacity) { + return c; + } else { + return 0.0; + } + }; + + void initializeFrom(InputRecord &ir) override { + Material :: initializeFrom(ir); + + IR_GIVE_OPTIONAL_FIELD(ir, e, _IFT_TMSimpleMaterial_E); + IR_GIVE_OPTIONAL_FIELD(ir, nu, _IFT_TMSimpleMaterial_nu); + IR_GIVE_OPTIONAL_FIELD(ir, lambda, _IFT_TMSimpleMaterial_lambda); + IR_GIVE_OPTIONAL_FIELD(ir, alpha, _IFT_TMSimpleMaterial_alpha); + IR_GIVE_OPTIONAL_FIELD(ir, c, _IFT_TMSimpleMaterial_c); + + }; + // void giveInputRecord(DynamicInputRecord &input) override {}; + void giveInputRecord(DynamicInputRecord &input) override {}; + MaterialStatus *CreateStatus(GaussPoint *gp) const override { return new TMMaterialStatus(gp); } + + const char *giveClassName() const override {return "TMSimpleMaterial";} + const char *giveInputRecordName() const override {return _IFT_TMSimpleMaterial_Name;} + int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep) override { + TMMaterialStatus *status = static_cast< TMMaterialStatus * >( this->giveStatus(gp) ); + if ( type == IST_StrainTensor ) { + answer = status->giveStrainVector(); + return 1; + } + if ( type == IST_StressTensor ) { + answer = status->giveStressVector(); + return 1; + } else { + return Material::giveIPValue(answer, gp, type, tStep); + } + } + +}; +REGISTER_Material(TMSimpleMaterial) + +} // end namespace oofem diff --git a/src/mpm/up.C b/src/mpm/up.C index cf7793697..ef41f3bbc 100644 --- a/src/mpm/up.C +++ b/src/mpm/up.C @@ -86,12 +86,12 @@ class UPElement : public MPElement { int pdofs = this->giveNumberOfPDofs(); answer.resize(pdofs,pdofs); answer.zero(); - this->integrateTerm_dw (answer, gNTfTerm(getP(), getP()), ir, tStep) ; + this->integrateTerm_dw (answer, gNTfTerm(getP(), getP(), Permeability, FluidMassBalancePressureContribution), ir, tStep) ; } else if (type == MassBalance_CompresibilityMatrix) { int pdofs = this->giveNumberOfPDofs(); answer.resize(pdofs,pdofs); answer.zero(); - this->integrateTerm_dw (answer, NTcN(getP(), getP()), ir, tStep) ; + this->integrateTerm_dw (answer, NTcN(getP(), getP(), CompressibilityCoefficient), ir, tStep) ; } else if (type == MassBalance_StressCouplingMatrix) { answer.resize(this->giveNumberOfPDofs(),this->giveNumberOfUDofs()); answer.zero(); @@ -118,11 +118,11 @@ class UPElement : public MPElement { } else if (type == MassBalance_PressureResidual) { answer.resize(this->giveNumberOfPDofs()); answer.zero(); - this->integrateTerm_c (answer, gNTfTerm(getP(), getP()), ir, tStep) ; + this->integrateTerm_c (answer, gNTfTerm(getP(), getP(), Permeability, FluidMassBalancePressureContribution), ir, tStep) ; } else if (type == MassBalance_PressureRateResidual) { answer.resize(this->giveNumberOfPDofs()); answer.zero(); - this->integrateTerm_c (answer, NTcN(getP(), getP()), ir, tStep) ; + this->integrateTerm_c (answer, NTcN(getP(), getP(), CompressibilityCoefficient), ir, tStep) ; } else if (type == ExternalForcesVector) { answer.zero(); } else { @@ -144,7 +144,7 @@ class UPElement : public MPElement { // integrate traction contribution (momentum balance) int o = getU().interpolation.giveInterpolationOrder()+load->giveApproxOrder(); - std::unique_ptr ir = this->getGeometryInterpolation().giveBoundarySurfaceIntegrationRule(o, boundary); + std::unique_ptr ir = this->getGeometryInterpolation().giveBoundarySurfaceIntegrationRule(o, boundary, this->giveGeometryType()); this->integrateSurfaceTerm_c(contrib, NTf_Surface(getU(), BoundaryFluxFunctor(load, boundary, getU().dofIDs, 's'), boundary), ir.get(), boundary, tStep); answer.resize(this->getNumberOfSurfaceDOFs()); @@ -153,7 +153,7 @@ class UPElement : public MPElement { // integrate mass (fluid) flux normal to the boundary (mass balance) o = getP().interpolation.giveInterpolationOrder()+load->giveApproxOrder(); - std::unique_ptr ir2 = this->getGeometryInterpolation().giveBoundarySurfaceIntegrationRule(o, boundary); + std::unique_ptr ir2 = this->getGeometryInterpolation().giveBoundarySurfaceIntegrationRule(o, boundary, this->giveGeometryType()); this->integrateSurfaceTerm_c(contrib2, NTf_Surface(getP(), BoundaryFluxFunctor(load, boundary, getP().dofIDs,'s'), boundary), ir2.get(), boundary, tStep); answer.assemble(contrib2, locp); } @@ -172,7 +172,7 @@ class UPElement : public MPElement { // integrate traction contribution (momentum balance) int o = getU().interpolation.giveInterpolationOrder()+load->giveApproxOrder(); - std::unique_ptr ir = this->getGeometryInterpolation().giveBoundaryEdgeIntegrationRule(o, boundary); + std::unique_ptr ir = this->getGeometryInterpolation().giveBoundaryEdgeIntegrationRule(o, boundary, this->giveGeometryType()); this->integrateEdgeTerm_c(contrib, NTf_Edge(getU(), BoundaryFluxFunctor(load, boundary, getU().dofIDs,'e'), boundary), ir.get(), boundary, tStep); answer.resize(this->getNumberOfEdgeDOFs()); @@ -181,7 +181,7 @@ class UPElement : public MPElement { // integrate mass (fluid) flux normal to the boundary (mass balance) o = getP().interpolation.giveInterpolationOrder()+load->giveApproxOrder(); - std::unique_ptr ir2 = this->getGeometryInterpolation().giveBoundaryEdgeIntegrationRule(o, boundary); + std::unique_ptr ir2 = this->getGeometryInterpolation().giveBoundaryEdgeIntegrationRule(o, boundary, this->giveGeometryType()); this->integrateEdgeTerm_c(contrib2, NTf_Edge(getP(), BoundaryFluxFunctor(load, boundary, getP().dofIDs,'e'), boundary), ir2.get(), boundary, tStep); answer.assemble(contrib2, locp); } @@ -579,9 +579,9 @@ class UPSimpleMaterial : public Material { public: UPSimpleMaterial (int n, Domain* d) : Material (n,d) {e=1.0; nu=0.15; k=1.0; alpha=1.0; c=0.1; muw = 1.0;} - void giveCharacteristicMatrix(FloatMatrix &answer, CharType type, GaussPoint* gp, TimeStep *tStep) override { + void giveCharacteristicMatrix(FloatMatrix &answer, MatResponseMode type, GaussPoint* gp, TimeStep *tStep) const override { MaterialMode mmode = gp->giveMaterialMode(); - if (type == StiffnessMatrix) { + if (type == TangentStiffness) { double ee; ee = e / ( ( 1. + nu ) * ( 1. - 2. * nu ) ); @@ -603,7 +603,7 @@ class UPSimpleMaterial : public Material { answer.at(6, 6) = ( 1. - 2. * nu ) * 0.5; answer.times(ee); - } else if (type == PermeabilityMatrix) { + } else if (type == Permeability) { if (mmode == _3dUP) { answer.resize(3,3); answer.beUnitMatrix(); @@ -616,12 +616,12 @@ class UPSimpleMaterial : public Material { } } - void giveCharacteristicVector(FloatArray &answer, FloatArray& flux, CharType type, GaussPoint* gp, TimeStep *tStep) override { - if (type == InternalForcesVector) { + void giveCharacteristicVector(FloatArray &answer, FloatArray& flux, MatResponseMode type, GaussPoint* gp, TimeStep *tStep) const override { + if (type == Stress) { FloatMatrix d; UPMaterialStatus *status = static_cast< UPMaterialStatus * >( this->giveStatus(gp) ); - this->giveCharacteristicMatrix(d, StiffnessMatrix, gp, tStep); + this->giveCharacteristicMatrix(d, TangentStiffness, gp, tStep); answer.beProductOf(d, flux); // update gp status status->letTempStrainVectorBe(flux); @@ -629,13 +629,13 @@ class UPSimpleMaterial : public Material { }else if (type == FluidMassBalancePressureContribution) { FloatMatrix k; - this->giveCharacteristicMatrix(k, PermeabilityMatrix, gp, tStep); + this->giveCharacteristicMatrix(k, Permeability, gp, tStep); answer.beProductOf(k, flux); } } - double giveCharacteristicValue(CharType type, GaussPoint* gp, TimeStep *tStep) override { + double giveCharacteristicValue(MatResponseMode type, GaussPoint* gp, TimeStep *tStep) const override { if (type == BiotConstant) { return alpha; } else if (type == CompressibilityCoefficient) { diff --git a/src/oofemcfg.h.in b/src/oofemcfg.h.in index 8a46fc59e..e6d88feb6 100644 --- a/src/oofemcfg.h.in +++ b/src/oofemcfg.h.in @@ -1,15 +1,3 @@ -/* Headers */ - -/* Define if execinfo.h defined */ -#cmakedefine HAVE_EXECINFO_H 1 - -/* Symbols */ -/* Define if cbrt is defined */ -#cmakedefine HAVE_CBRT 1 - -/* Define if isnan is defined */ -#cmakedefine HAVE_ISNAN 1 - @OOFEM_EXPORT_HEADER@ #define __OOFEM_MAJOR_VERSION "@oofem_VERSION_MAJOR@" @@ -20,15 +8,15 @@ #define __HOST_NAME "@HOST_NAME@" #define __MODULE_LIST "@MODULE_LIST@" -extern const char* PRG_VERSION; -extern const char* OOFEG_VERSION; -extern const char* OOFEM_COPYRIGHT; -extern const char* PRG_HEADER; -extern const char* PRG_HEADER_SM; -extern const char* HOST_TYPE; -extern const char* HOST_NAME; -extern const char* MODULE_LIST; -extern const char* OOFEM_GIT_HASH; -extern const char* OOFEM_GIT_REPOURL; -extern const char* OOFEM_GIT_BRANCH; +OOFEM_EXPORT extern const char* PRG_VERSION; +OOFEM_EXPORT extern const char* OOFEG_VERSION; +OOFEM_EXPORT extern const char* OOFEM_COPYRIGHT; +OOFEM_EXPORT extern const char* PRG_HEADER; +OOFEM_EXPORT extern const char* PRG_HEADER_SM; +OOFEM_EXPORT extern const char* HOST_TYPE; +OOFEM_EXPORT extern const char* HOST_NAME; +OOFEM_EXPORT extern const char* MODULE_LIST; +OOFEM_EXPORT extern const char* OOFEM_GIT_HASH; +OOFEM_EXPORT extern const char* OOFEM_GIT_REPOURL; +OOFEM_EXPORT extern const char* OOFEM_GIT_BRANCH; # \ No newline at end of file diff --git a/src/oofemenv.h.in b/src/oofemenv.h.in new file mode 100644 index 000000000..d9ca4754b --- /dev/null +++ b/src/oofemenv.h.in @@ -0,0 +1,18 @@ +/* Headers */ +#include + +/* Define if execinfo.h defined */ +#cmakedefine HAVE_EXECINFO_H 1 + +/* Symbols */ +/* Define if cbrt is defined */ +#cmakedefine HAVE_CBRT 1 + +/* Define if isnan is defined */ +#cmakedefine HAVE_ISNAN 1 + +/* Define type used to represent array indices and array sizes*/ +typedef std::size_t indexType; + +@OOFEM_EXPORT_HEADER@ + diff --git a/src/oofemlib/CMakeLists.txt b/src/oofemlib/CMakeLists.txt index a7d6b3cee..aa4a9eb4c 100644 --- a/src/oofemlib/CMakeLists.txt +++ b/src/oofemlib/CMakeLists.txt @@ -40,6 +40,10 @@ set (core_unsorted unstructuredgridfield.C # loadbalancer.C + # + vtkhdf5reader.C + # + oofemcfg.C ) #oofegutils @@ -374,7 +378,7 @@ set (core ${core_mapping} ) -if (USE_PARALLEL) +if (USE_MPI_PARALLEL) list (APPEND core ${core_parallel}) endif () diff --git a/src/oofemlib/activebc.h b/src/oofemlib/activebc.h index 338e2a842..c7bfba110 100644 --- a/src/oofemlib/activebc.h +++ b/src/oofemlib/activebc.h @@ -171,7 +171,6 @@ class OOFEM_EXPORT ActiveBoundaryCondition : public GeneralBoundaryCondition virtual int giveNumberOfMasterDofs(ActiveDof *dof) { OOFEM_ERROR("Not supported by bc."); - return 0; } /** * Give the pointer to master dof belonging to active DOF. @@ -182,7 +181,6 @@ class OOFEM_EXPORT ActiveBoundaryCondition : public GeneralBoundaryCondition virtual Dof *giveMasterDof(ActiveDof *dof, int mdof) { OOFEM_ERROR("Not supported by bc."); - return nullptr; } virtual void computeDofTransformation(ActiveDof *dof, FloatArray &masterContribs) { @@ -199,7 +197,6 @@ class OOFEM_EXPORT ActiveBoundaryCondition : public GeneralBoundaryCondition virtual double giveUnknown(PrimaryField &field, ValueModeType mode, TimeStep *tStep, ActiveDof *dof) { OOFEM_ERROR("Not supported by bc."); - return 0.0; } /** * Computes the value of the dof. @@ -211,7 +208,6 @@ class OOFEM_EXPORT ActiveBoundaryCondition : public GeneralBoundaryCondition virtual double giveUnknown(ValueModeType mode, TimeStep *tStep, ActiveDof *dof) { OOFEM_ERROR("Not supported by bc."); - return 0.0; } //@} }; diff --git a/src/oofemlib/assemblercallback.h b/src/oofemlib/assemblercallback.h index 7140be24f..2fbc2db07 100644 --- a/src/oofemlib/assemblercallback.h +++ b/src/oofemlib/assemblercallback.h @@ -35,7 +35,7 @@ #ifndef assemblercallback_h #define assemblercallback_h -#include "oofem_export.h" +#include "oofemenv.h" #include "valuemodetype.h" ///@todo We shouldn't have this for assembling vectors or matrices(!) / Mikael #include "matresponsemode.h" #include "chartype.h" diff --git a/src/oofemlib/bctracker.C b/src/oofemlib/bctracker.C index 07a646d04..c7933485e 100644 --- a/src/oofemlib/bctracker.C +++ b/src/oofemlib/bctracker.C @@ -42,7 +42,10 @@ #include "nodalload.h" #include "activebc.h" #include "timestep.h" - +#ifdef __SM_MODULE +#include "Loads/structtemperatureload.h" +#include "Loads/structeigenstrainload.h" +#endif namespace oofem { BCTracker :: BCTracker(Domain* d) { @@ -92,6 +95,15 @@ BCTracker::initialize() { this->elemList[eid-1].push_back(entry); } } +#ifdef __SM_MODULE + else if ( ( load = dynamic_cast< StructuralTemperatureLoad * >(bc) ) || ( load = dynamic_cast< StructuralEigenstrainLoad * >(bc) )) { // Body load: + const IntArray &elements = set->giveElementList(); + for ( int ielem = 1; ielem <= elements.giveSize(); ++ielem ) { + Entry entry (ibc, 0); + this->elemList[elements.at(ielem)-1].push_back(entry); + } + } +#endif } }// end loop over BCs } diff --git a/src/oofemlib/boundaryload.C b/src/oofemlib/boundaryload.C index b5918bf8e..83b532f44 100644 --- a/src/oofemlib/boundaryload.C +++ b/src/oofemlib/boundaryload.C @@ -64,7 +64,7 @@ BoundaryLoad :: computeValueAt(FloatArray &answer, TimeStep *tStep, const FloatA double factor; FloatArray N; - if ( ( mode != VM_Total ) && ( mode != VM_Incremental ) ) { + if ( ( mode != VM_Total ) && ( mode != VM_Incremental ) && (mode != VM_TotalIntrinsic) ) { OOFEM_ERROR("unknown mode"); } @@ -129,7 +129,7 @@ BoundaryLoad :: giveInputRecord(DynamicInputRecord &input) double -BoundaryLoad :: giveProperty(int aProperty, TimeStep *tStep, const std :: map< std :: string, FunctionArgument > &valDict) +BoundaryLoad :: giveProperty(int aProperty, TimeStep *tStep, const std :: map< std :: string, FunctionArgument > &valDict) const { double answer; if ( propertyDictionary.includes(aProperty) ) { @@ -150,7 +150,7 @@ BoundaryLoad :: giveProperty(int aProperty, TimeStep *tStep, const std :: map< s } double -BoundaryLoad :: giveProperty(int aProperty, TimeStep *tStep) +BoundaryLoad :: giveProperty(int aProperty, TimeStep *tStep) const { return this->giveProperty(aProperty, tStep, {}); } diff --git a/src/oofemlib/boundaryload.h b/src/oofemlib/boundaryload.h index 17da2518e..ce0617e6e 100644 --- a/src/oofemlib/boundaryload.h +++ b/src/oofemlib/boundaryload.h @@ -164,8 +164,8 @@ class OOFEM_EXPORT BoundaryLoad : public Load * See cltypes.h file for details. */ bcType giveType() const override { return lType; } - virtual double giveProperty(int aProperty, TimeStep *tStep, const std :: map< std :: string, FunctionArgument > &valDict); - double giveProperty(int aProperty, TimeStep *tStep) override; + virtual double giveProperty(int aProperty, TimeStep *tStep, const std :: map< std :: string, FunctionArgument > &valDict) const; + double giveProperty(int aProperty, TimeStep *tStep) const override; /// Return temperature offset virtual double giveTemperOffset(void); /// Expression to multiply all properties diff --git a/src/oofemlib/chartype.h b/src/oofemlib/chartype.h index d249d1642..47417e10f 100644 --- a/src/oofemlib/chartype.h +++ b/src/oofemlib/chartype.h @@ -85,9 +85,9 @@ namespace oofem { ENUM_ITEM_WITH_VALUE(DivergenceVelocityVector, 214) \ /* MPM */ \ ENUM_ITEM_WITH_VALUE(PermeabilityMatrix, 250) \ - ENUM_ITEM_WITH_VALUE(FluidMassBalancePressureContribution, 251) \ - ENUM_ITEM_WITH_VALUE(BiotConstant, 252) \ - ENUM_ITEM_WITH_VALUE(CompressibilityCoefficient, 253) \ + /*ENUM_ITEM_WITH_VALUE(FluidMassBalancePressureContribution, 251)*/ \ + /*ENUM_ITEM_WITH_VALUE(BiotConstant, 252) */ \ + /*ENUM_ITEM_WITH_VALUE(CompressibilityCoefficient, 253)*/ \ ENUM_ITEM_WITH_VALUE(MomentumBalance_StiffnessMatrix, 254) \ ENUM_ITEM_WITH_VALUE(MomentumBalance_PressureCouplingMatrix, 255) \ ENUM_ITEM_WITH_VALUE(MassBalance_PermeabilityMatrix, 256) \ @@ -98,7 +98,7 @@ namespace oofem { ENUM_ITEM_WITH_VALUE(MassBalance_StressRateResidual, 261) \ ENUM_ITEM_WITH_VALUE(MassBalance_PressureResidual, 262) \ ENUM_ITEM_WITH_VALUE(MassBalance_PressureRateResidual, 263) \ - ENUM_ITEM_WITH_VALUE(FluidViscosity, 264) \ + /*ENUM_ITEM_WITH_VALUE(FluidViscosity, 264)*/ \ /* MPM UPV */ \ ENUM_ITEM_WITH_VALUE(MassBalance_UdotTerm, 265) \ ENUM_ITEM_WITH_VALUE(MassBalance_VTerm, 266) \ @@ -120,7 +120,21 @@ namespace oofem { ENUM_ITEM_WITH_VALUE(MomentumBalance_2_Residual, 282) \ ENUM_ITEM_WITH_VALUE(MomentumBalance_3_Residual, 283) \ ENUM_ITEM_WITH_VALUE(MomentumBalance_4_Residual, 284) \ - ENUM_ITEM_WITH_VALUE(InitialVolumeFraction, 285) + ENUM_ITEM_WITH_VALUE(InitialVolumeFraction, 285) \ + /* MPM ThermoMechanics*/ \ + ENUM_ITEM_WITH_VALUE(EnergyBalance_ConductivityMatrix, 300) \ + ENUM_ITEM_WITH_VALUE(EnergyBalance_CapacityMatrix, 301) \ + ENUM_ITEM_WITH_VALUE(EnergyBalance_StressCouplingMatrix, 302) \ + ENUM_ITEM_WITH_VALUE(EnergyBalance_Residual, 303) \ + ENUM_ITEM_WITH_VALUE(EnergyBalance_TemperatureResidual, 304) \ + ENUM_ITEM_WITH_VALUE(EnergyBalance_DSigmaDTMatrix, 305) \ + ENUM_ITEM_WITH_VALUE(InternalFluxVector, 306) \ + ENUM_ITEM_WITH_VALUE(MomentumBalance_ThermalCouplingMatrix, 307) \ + ENUM_ITEM_WITH_VALUE(EnergyBalance_ConvectionBCMatrix, 308) \ + ENUM_ITEM_WITH_VALUE(EnergyBalance_ConvectionBCResidual, 309) \ + ENUM_ITEM_WITH_VALUE(EnergyBalance_InternalSourceVector, 310) + + diff --git a/src/oofemlib/classfactory.h b/src/oofemlib/classfactory.h index 684b994b9..61b2ae99d 100644 --- a/src/oofemlib/classfactory.h +++ b/src/oofemlib/classfactory.h @@ -35,7 +35,7 @@ #ifndef classfactory_h #define classfactory_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "sparsemtrxtype.h" #include "errorestimatortype.h" #include "doftype.h" diff --git a/src/oofemlib/cltypes.C b/src/oofemlib/cltypes.C index 654ab8adb..1f290262a 100644 --- a/src/oofemlib/cltypes.C +++ b/src/oofemlib/cltypes.C @@ -69,8 +69,6 @@ char cltypesGiveUnknownTypeModeKey(ValueModeType mode) default: OOFEM_ERROR("unsupported ValueModeType"); } - - return 0; } @@ -256,7 +254,6 @@ InternalStateValueType giveInternalStateValueType(UnknownType type) return ISVT_SCALAR; } else { OOFEM_ERROR( "unsupported UnknownType %s", __UnknownTypeToString(type) ); - return ISVT_SCALAR; // To make compiler happy. } } diff --git a/src/oofemlib/combuff.C b/src/oofemlib/combuff.C index 2795c919e..4758693e3 100644 --- a/src/oofemlib/combuff.C +++ b/src/oofemlib/combuff.C @@ -43,7 +43,7 @@ namespace oofem { #ifdef __USE_MPI -MPIBuffer :: MPIBuffer(int size, bool dynamic) +MPIBuffer :: MPIBuffer(std::size_t size, bool dynamic) { this->size = 0; curr_pos = 0; @@ -75,7 +75,7 @@ MPIBuffer :: ~MPIBuffer() int -MPIBuffer :: resize(int newSize) +MPIBuffer :: resize(std::size_t newSize) { // do not shrink if ( size >= newSize ) { @@ -120,7 +120,7 @@ MPIBuffer :: init() #ifdef __USE_MPI int -MPIBuffer :: packArray(MPI_Comm communicator, const void *src, int n, MPI_Datatype type) +MPIBuffer :: packArray(MPI_Comm communicator, const void *src, std::size_t n, MPI_Datatype type) { int _size; // ask MPI for packing size for integer @@ -139,15 +139,23 @@ MPIBuffer :: packArray(MPI_Comm communicator, const void *src, int n, MPI_Dataty } void *__src = const_cast< void * >(src); // throw away const - return ( MPI_Pack(__src, n, type, this->buff, this->size, - & this->curr_pos, communicator) == MPI_SUCCESS ); + // MPI_Pack requires int for current position + int _currPosInt = static_cast(this->curr_pos); + int result = (MPI_Pack(__src, n, type, this->buff, this->size, + & _currPosInt, communicator) == MPI_SUCCESS ); + this->curr_pos = static_cast(_currPosInt); + return result; } int -MPIBuffer :: unpackArray(MPI_Comm communicator, void *dest, int n, MPI_Datatype type) +MPIBuffer :: unpackArray(MPI_Comm communicator, void *dest, std::size_t n, MPI_Datatype type) { - return ( MPI_Unpack(this->buff, this->size, & this->curr_pos, - dest, n, type, communicator) == MPI_SUCCESS ); + // MPI_Pack requires int for current position + int _currPosInt = static_cast(this->curr_pos); + int result = (MPI_Unpack(this->buff, this->size, & _currPosInt, + dest, n, type, communicator) == MPI_SUCCESS ); + this->curr_pos = static_cast(_currPosInt); + return result; } int @@ -159,7 +167,7 @@ MPIBuffer :: iSend(MPI_Comm communicator, int dest, int tag) int -MPIBuffer :: iRecv(MPI_Comm communicator, int source, int tag, int count) +MPIBuffer :: iRecv(MPI_Comm communicator, int source, int tag, std::size_t count) { if ( count ) { if ( count >= this->size ) { @@ -215,11 +223,11 @@ MPIBuffer :: bcast(MPI_Comm communicator, int root) int -MPIBuffer :: givePackSize(MPI_Comm communicator, MPI_Datatype type, int size) +MPIBuffer :: givePackSize(MPI_Comm communicator, MPI_Datatype type, std::size_t size) { - int requredSpace; - MPI_Pack_size(size, type, communicator, & requredSpace); - return requredSpace; + int requiredSpace; + MPI_Pack_size(size, type, communicator, & requiredSpace); + return requiredSpace; } @@ -268,39 +276,47 @@ int CommunicationBuffer :: write(bool data) return this->write(& val, 1); } -int CommunicationBuffer :: givePackSizeOfInt(int count) +int CommunicationBuffer :: givePackSizeOfInt(std::size_t count) { int requiredSpace; - MPI_Pack_size(count, MPI_INT, communicator, & requiredSpace); + MPI_Pack_size(count, my_MPI_SIZE_T, communicator, & requiredSpace); return requiredSpace; } -int CommunicationBuffer :: givePackSizeOfDouble(int count) +int CommunicationBuffer :: givePackSizeOfDouble(std::size_t count) { int requiredSpace; MPI_Pack_size(count, MPI_DOUBLE, communicator, & requiredSpace); return requiredSpace; } -int CommunicationBuffer :: givePackSizeOfChar(int count) +int CommunicationBuffer :: givePackSizeOfChar(std::size_t count) { int requiredSpace; MPI_Pack_size(count, MPI_CHAR, communicator, & requiredSpace); return requiredSpace; } -int CommunicationBuffer :: givePackSizeOfBool(int count) +int CommunicationBuffer :: givePackSizeOfBool(std::size_t count) { int requiredSpace; MPI_Pack_size(count, MPI_CHAR, communicator, & requiredSpace); return requiredSpace; } -int CommunicationBuffer :: givePackSizeOfLong(int count) +int CommunicationBuffer :: givePackSizeOfLong(std::size_t count) { int requiredSpace; MPI_Pack_size(count, MPI_LONG, communicator, & requiredSpace); return requiredSpace; } +int CommunicationBuffer :: givePackSizeOfSizet(std::size_t count) +{ + int requiredSpace; + MPI_Pack_size(count, my_MPI_SIZE_T, communicator, & requiredSpace); + return requiredSpace; +} + + } // end namespace oofem diff --git a/src/oofemlib/combuff.h b/src/oofemlib/combuff.h index 70e6406de..beca42d19 100644 --- a/src/oofemlib/combuff.h +++ b/src/oofemlib/combuff.h @@ -35,12 +35,31 @@ #ifndef combuff_h #define combuff_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "datastream.h" #include "parallel.h" namespace oofem { +#include +#include + +#if SIZE_MAX == UCHAR_MAX + #define my_MPI_SIZE_T MPI_UNSIGNED_CHAR +#elif SIZE_MAX == USHRT_MAX + #define my_MPI_SIZE_T MPI_UNSIGNED_SHORT +#elif SIZE_MAX == UINT_MAX + #define my_MPI_SIZE_T MPI_UNSIGNED +#elif SIZE_MAX == ULONG_MAX + #define my_MPI_SIZE_T MPI_UNSIGNED_LONG +#elif SIZE_MAX == ULLONG_MAX + #define my_MPI_SIZE_T MPI_UNSIGNED_LONG_LONG +#else + #error "what is happening here?" +#endif + + + #define __CommunicationBuffer_ALLOC_CHUNK 1024 /** * Type with size equal to one byte (sizeof (ComBuff_BYTE_TYPE) should be 1). @@ -52,7 +71,7 @@ class OOFEM_EXPORT MPIBuffer { protected: /// Size and current position in buffer in bytes (sizeof(char)). - int size, curr_pos; + std::size_t size, curr_pos; /// Dynamic flag (if true, buffer can grow, but reallocation is needed). bool isDynamic; /// Buffer. Dynamically allocated. @@ -66,7 +85,7 @@ class OOFEM_EXPORT MPIBuffer public: /// Constructor. Creates buffer of given size, using given communicator for packing. - MPIBuffer(int size, bool dynamic = 0); + MPIBuffer(std::size_t size, bool dynamic = 0); /// Constructor. Creates empty buffer, using given communicator for packing. MPIBuffer(bool dynamic = 0); /// Destructor. @@ -80,16 +99,16 @@ class OOFEM_EXPORT MPIBuffer * @param newSize new buffer size in bytes. * @return nonzero if successful. */ - int resize(int newSize); + int resize(std::size_t newSize); /** * Initializes buffer to empty state. All packed data are lost. */ virtual void init(); /// @return Current buffer size. - int giveSize() { return size; } + std::size_t giveSize() { return size; } /// @return Remaining space. - int giveAvailableSpace() { return ( size - curr_pos ); } + std::size_t giveAvailableSpace() { return ( size - curr_pos ); } /** * Returns associated MPI request handle */ @@ -104,7 +123,7 @@ class OOFEM_EXPORT MPIBuffer * @param type Determines type of array values. * @return Nonzero if successful. */ - int packArray(MPI_Comm communicator, const void *src, int n, MPI_Datatype type); + int packArray(MPI_Comm communicator, const void *src, std::size_t n, MPI_Datatype type); /** * Unpacks array of values of given type from buffer. * @param communicator Communicator handle. @@ -113,7 +132,7 @@ class OOFEM_EXPORT MPIBuffer * @param type Determines type of array values. * @return Nonzero if successful. */ - int unpackArray(MPI_Comm communicator, void *dest, int n, MPI_Datatype type); + int unpackArray(MPI_Comm communicator, void *dest, std::size_t n, MPI_Datatype type); /**@name Methods for determining pack size of datatype to pack/unpack to/from buffer */ @@ -125,7 +144,7 @@ class OOFEM_EXPORT MPIBuffer * @param size Size of array to pack. * @return Pack size required. */ - int givePackSize(MPI_Comm communicator, MPI_Datatype type, int size); + int givePackSize(MPI_Comm communicator, MPI_Datatype type, std::size_t size); //@} /**@name Services for buffer sending/receiving */ @@ -147,7 +166,7 @@ class OOFEM_EXPORT MPIBuffer * @param communicator Request communicator (handle). * @return MPI_SUCCESS if ok. */ - virtual int iRecv(MPI_Comm communicator, int source, int tag, int count = 0); + virtual int iRecv(MPI_Comm communicator, int source, int tag, std::size_t count = 0); /** * Tests if the operation identified by this->request is complete. * In such case, true is returned and @@ -189,7 +208,7 @@ class OOFEM_EXPORT MPIBuffer private: /// @return Current buffer position. - int givePosition() { return curr_pos; } + std::size_t givePosition() { return curr_pos; } }; @@ -210,7 +229,7 @@ class OOFEM_EXPORT CommunicationBuffer: public DataStream protected: MPI_Comm communicator; public: - CommunicationBuffer(MPI_Comm comm, int size, bool dynamic = 0) : communicator(comm) { } + CommunicationBuffer(MPI_Comm comm, std::size_t size, bool dynamic = 0) : communicator(comm) { } /// Constructor. Creates empty buffer, using given communicator for packing CommunicationBuffer(MPI_Comm comm, bool dynamic = 0) : communicator(comm) { } /// Destructor. @@ -224,7 +243,7 @@ class OOFEM_EXPORT CommunicationBuffer: public DataStream * @param newSize New buffer size in bytes. * @return Nonzero if successful. */ - virtual int resize(int newSize) = 0; + virtual int resize(std::size_t newSize) = 0; /** * Initializes buffer to empty state. All packed data are lost. */ @@ -241,11 +260,13 @@ class OOFEM_EXPORT CommunicationBuffer: public DataStream using DataStream::write; int write(bool data) override; - int givePackSizeOfInt(int count) override; - int givePackSizeOfDouble(int count) override; - int givePackSizeOfChar(int count) override; - int givePackSizeOfBool(int count) override; - int givePackSizeOfLong(int count) override; + int givePackSizeOfInt(std::size_t count) override; + int givePackSizeOfDouble(std::size_t count) override; + int givePackSizeOfChar(std::size_t count) override; + int givePackSizeOfBool(std::size_t count) override; + int givePackSizeOfLong(std::size_t count) override; + int givePackSizeOfSizet(std::size_t count) override; + /**@name Services for buffer sending/receiving */ //@{ @@ -264,7 +285,7 @@ class OOFEM_EXPORT CommunicationBuffer: public DataStream * If zero (default value) buffer is not resized. * @return MPI_SUCCESS if ok. */ - virtual int iRecv(int source, int tag, int count = 0) = 0; + virtual int iRecv(int source, int tag, std::size_t count = 0) = 0; /** * Tests if the operation identified by this->request is complete. * In such case, true is returned and @@ -304,39 +325,44 @@ class OOFEM_EXPORT StaticCommunicationBuffer : public CommunicationBuffer, publi /// Destructor. virtual ~StaticCommunicationBuffer() { } - int resize(int newSize) override { return MPIBuffer :: resize(newSize); } + int resize(std::size_t newSize) override { return MPIBuffer :: resize(newSize); } void init() override { return MPIBuffer :: init(); } void initForPacking() override { this->init(); } void initForUnpacking() override { this->init(); } using CommunicationBuffer::write; - int write(const int *src, int n) override + int write(const int *src, std::size_t n) override { return MPIBuffer :: packArray(this->communicator, src, n, MPI_INT); } - int write(const long *src, int n) override + int write(const long *src, std::size_t n) override { return MPIBuffer :: packArray(this->communicator, src, n, MPI_LONG); } - int write(const unsigned long *src, int n) override + int write(const unsigned long *src, std::size_t n) override { return MPIBuffer :: packArray(this->communicator, src, n, MPI_UNSIGNED_LONG); } - int write(const double *src, int n) override + int write(const double *src, std::size_t n) override { return MPIBuffer :: packArray(this->communicator, src, n, MPI_DOUBLE); } - int write(const char *src, int n) override + int write(const char *src, std::size_t n) override { return MPIBuffer :: packArray(this->communicator, src, n, MPI_CHAR); } using CommunicationBuffer::read; - int read(int *dest, int n) override + int read(int *dest, std::size_t n) override { return MPIBuffer :: unpackArray(this->communicator, dest, n, MPI_INT); } - int read(long *dest, int n) override + int read(long *dest, std::size_t n) override { return MPIBuffer :: unpackArray(this->communicator, dest, n, MPI_LONG); } - int read(unsigned long *dest, int n) override + int read(unsigned long *dest, std::size_t n) override { return MPIBuffer :: unpackArray(this->communicator, dest, n, MPI_UNSIGNED_LONG); } - int read(double *dest, int n) override + int read(double *dest, std::size_t n) override { return MPIBuffer :: unpackArray(this->communicator, dest, n, MPI_DOUBLE); } - int read(char *dest, int n) override + int read(char *dest, std::size_t n) override { return MPIBuffer :: unpackArray(this->communicator, dest, n, MPI_CHAR); } + #ifdef _MSC_VER + int read(std::size_t* data, std::size_t count) override { return MPIBuffer :: unpackArray(this->communicator, data, count, my_MPI_SIZE_T); } + int write(const std::size_t* data, std::size_t count) override { return MPIBuffer :: packArray(this->communicator, data, count, my_MPI_SIZE_T); } + #endif + int iSend(int dest, int tag) override { return MPIBuffer :: iSend(this->communicator, dest, tag); } - int iRecv(int source, int tag, int count = 0) override { return MPIBuffer :: iRecv(this->communicator, source, tag, count); } + int iRecv(int source, int tag, std::size_t count = 0) override { return MPIBuffer :: iRecv(this->communicator, source, tag, count); } int testCompletion() override { return MPIBuffer :: testCompletion(); } diff --git a/src/oofemlib/communicator.h b/src/oofemlib/communicator.h index 25643a2d2..9ba1d1072 100644 --- a/src/oofemlib/communicator.h +++ b/src/oofemlib/communicator.h @@ -35,7 +35,7 @@ #ifndef communicator_h #define communicator_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "processcomm.h" #include "commbufftype.h" #include "communicatormode.h" diff --git a/src/oofemlib/compcol.C b/src/oofemlib/compcol.C index 0ebe00790..00f99d367 100644 --- a/src/oofemlib/compcol.C +++ b/src/oofemlib/compcol.C @@ -356,7 +356,6 @@ double &CompCol :: at(int i, int j) } OOFEM_ERROR("Array accessing exception -- (%d,%d) out of bounds", i, j); - return val[0]; // return to suppress compiler warning message } @@ -373,7 +372,7 @@ double CompCol :: at(int i, int j) const } else { OOFEM_ERROR("Array accessing exception -- (%d,%d) out of bounds", i, j); } - return 0.; // return to suppress compiler warning message + // return 0.; // return to suppress compiler warning message } double CompCol :: operator() (int i, int j) const @@ -389,7 +388,7 @@ double CompCol :: operator() (int i, int j) const } else { OOFEM_ERROR("Array accessing exception -- (%d,%d) out of bounds", i, j); } - return 0.; // return to suppress compiler warning message + // return 0.; // return to suppress compiler warning message } double &CompCol :: operator() (int i, int j) @@ -403,7 +402,6 @@ double &CompCol :: operator() (int i, int j) } OOFEM_ERROR("Array element (%d,%d) not in sparse structure -- cannot assign", i, j); - return val[0]; // return to suppress compiler warning message } } // end namespace oofem diff --git a/src/oofemlib/connectivitytable.h b/src/oofemlib/connectivitytable.h index b50b8a2e2..bc3e63843 100644 --- a/src/oofemlib/connectivitytable.h +++ b/src/oofemlib/connectivitytable.h @@ -35,7 +35,7 @@ #ifndef contable_h #define contable_h -#include "oofemcfg.h" +#include "oofemenv.h" #include diff --git a/src/oofemlib/constantedgeload.C b/src/oofemlib/constantedgeload.C index e4679c4df..11aa5f438 100644 --- a/src/oofemlib/constantedgeload.C +++ b/src/oofemlib/constantedgeload.C @@ -50,7 +50,7 @@ ConstantEdgeLoad :: initializeFrom(InputRecord &ir) void ConstantEdgeLoad :: computeValueAt(FloatArray &answer, TimeStep *tStep, const FloatArray &coords, ValueModeType mode) { - if ( ( mode != VM_Total ) && ( mode != VM_Incremental ) ) { + if ( ( mode != VM_Total ) && ( mode != VM_Incremental ) && (mode != VM_TotalIntrinsic)) { OOFEM_ERROR("mode not supported"); } diff --git a/src/oofemlib/constantsurfaceload.C b/src/oofemlib/constantsurfaceload.C index 5312333ff..12d6894e7 100644 --- a/src/oofemlib/constantsurfaceload.C +++ b/src/oofemlib/constantsurfaceload.C @@ -65,7 +65,7 @@ ConstantSurfaceLoad :: giveInputRecord(DynamicInputRecord &input) void ConstantSurfaceLoad :: computeValueAt(FloatArray &answer, TimeStep *tStep, const FloatArray &coords, ValueModeType mode) { - if ( ( mode != VM_Total ) && ( mode != VM_Incremental ) ) { + if ( ( mode != VM_Total ) && ( mode != VM_Incremental ) && ( mode != VM_TotalIntrinsic ) ) { OOFEM_ERROR("mode not supported"); } diff --git a/src/oofemlib/contact/contactdefinition.h b/src/oofemlib/contact/contactdefinition.h index ecf48b09f..7ca33083c 100644 --- a/src/oofemlib/contact/contactdefinition.h +++ b/src/oofemlib/contact/contactdefinition.h @@ -35,7 +35,7 @@ #ifndef contactdefinition_h #define contactdefinition_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "datareader.h" #include "inputrecord.h" #include "contact/contactmanager.h" @@ -97,7 +97,7 @@ class OOFEM_EXPORT ContactDefinition const UnknownNumberingScheme &r_s, const UnknownNumberingScheme &c_s); ContactElement *giveContactElement(const int num) { return this->masterElementList[num-1]; } - int giveNumbertOfContactElements() { return this->masterElementList.size(); } + int giveNumbertOfContactElements() { return (int) this->masterElementList.size(); } void addContactElement(ContactElement *cEl) { this->masterElementList.push_back(cEl); } // objects can be of different kinds // nodes, segments, surfaces, analytical functions diff --git a/src/oofemlib/contact/contactelement.h b/src/oofemlib/contact/contactelement.h index ce7a5343b..6a55830ad 100644 --- a/src/oofemlib/contact/contactelement.h +++ b/src/oofemlib/contact/contactelement.h @@ -41,7 +41,7 @@ // remove -#include "oofemcfg.h" +#include "oofemenv.h" #include "datareader.h" #include "inputrecord.h" #include "intarray.h" diff --git a/src/oofemlib/contact/contactmanager.h b/src/oofemlib/contact/contactmanager.h index a996b22c5..e34e54d8b 100644 --- a/src/oofemlib/contact/contactmanager.h +++ b/src/oofemlib/contact/contactmanager.h @@ -37,7 +37,7 @@ #include "chartype.h" #include "valuemodetype.h" -#include "oofemcfg.h" +#include "oofemenv.h" #include "datareader.h" #include "inputrecord.h" diff --git a/src/oofemlib/contextioerr.h b/src/oofemlib/contextioerr.h index 0dffb4cd1..81c125d30 100644 --- a/src/oofemlib/contextioerr.h +++ b/src/oofemlib/contextioerr.h @@ -37,7 +37,7 @@ #include -#include "oofemcfg.h" +#include "oofemenv.h" #include "contextioresulttype.h" namespace oofem { diff --git a/src/oofemlib/crosssection.C b/src/oofemlib/crosssection.C index 54d9616a1..5fe544750 100644 --- a/src/oofemlib/crosssection.C +++ b/src/oofemlib/crosssection.C @@ -131,7 +131,7 @@ CrossSection :: give(CrossSectionProperty aProperty, GaussPoint *gp) const OOFEM_ERROR("Undefined property ID %d", aProperty); } - return 0.0; + //return 0.0; } double @@ -144,7 +144,7 @@ CrossSection :: give(CrossSectionProperty aProperty, const FloatArray &coords, E OOFEM_ERROR("Undefined property ID %d", aProperty); } - return 0.0; + // return 0.0; } diff --git a/src/oofemlib/datareader.h b/src/oofemlib/datareader.h index b435f3712..d0af3daf0 100644 --- a/src/oofemlib/datareader.h +++ b/src/oofemlib/datareader.h @@ -35,7 +35,7 @@ #ifndef datareader_h #define datareader_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "inputrecord.h" namespace oofem { diff --git a/src/oofemlib/datastream.C b/src/oofemlib/datastream.C index 6e2d07620..11878e61e 100644 --- a/src/oofemlib/datastream.C +++ b/src/oofemlib/datastream.C @@ -51,7 +51,7 @@ int DataStream :: read(std :: string &data) data = ""; return 0; } - data = std::string(str.data(), str.size()); + data = std::string(str.data(), n); return 1; } @@ -78,91 +78,110 @@ FileDataStream :: ~FileDataStream() fclose(this->stream); } -int FileDataStream :: read(int *data, int count) +int FileDataStream :: read(int *data, std::size_t count) { - return ( (int)fread(data, sizeof( int ), count, stream) == count ); + return ( fread(data, sizeof( int ), count, stream) == count ); //this->stream.read(reinterpret_cast< char* >(data), sizeof(int)*count); //return this->stream.good(); } -int FileDataStream :: read(unsigned long *data, int count) +int FileDataStream :: read(unsigned long *data, std::size_t count) { - return ( (int)fread(data, sizeof( unsigned long ), count, stream) == count ); + return ( fread(data, sizeof( unsigned long ), count, stream) == count ); } -int FileDataStream :: read(long *data, int count) +int FileDataStream :: read(long *data, std::size_t count) { - return ( (int)fread(data, sizeof( long ), count, stream) == count ); + return ( fread(data, sizeof( long ), count, stream) == count ); } -int FileDataStream :: read(double *data, int count) +#ifdef _MSC_VER +int FileDataStream::read(std::size_t* data, std::size_t count) { - return ( (int)fread(data, sizeof( double ), count, stream) == count ); + return (fread(data, sizeof(std::size_t), count, stream) == count); } +#endif -int FileDataStream :: read(char *data, int count) +int FileDataStream :: read(double *data, std::size_t count) { - return ( (int)fread(data, sizeof( char ), count, stream) == count ); + return ( fread(data, sizeof( double ), count, stream) == count ); +} + +int FileDataStream :: read(char *data, std::size_t count) +{ + return ( fread(data, sizeof( char ), count, stream) == count ); } int FileDataStream :: read(bool &data) { - return ( (int)fread(& data, sizeof( bool ), 1, stream) == 1 ); + return ( fread(& data, sizeof( bool ), 1, stream) == 1 ); } -int FileDataStream :: write(const int *data, int count) +int FileDataStream :: write(const int *data, std::size_t count) { - return ( (int)fwrite(data, sizeof( int ), count, stream) == count ); + return ( fwrite(data, sizeof( int ), count, stream) == count ); } -int FileDataStream :: write(const unsigned long *data, int count) +int FileDataStream :: write(const unsigned long *data, std::size_t count) { - return ( (int)fwrite(data, sizeof( unsigned long ), count, stream) == count ); + return ( fwrite(data, sizeof( unsigned long ), count, stream) == count ); } -int FileDataStream :: write(const long *data, int count) +#ifdef _MSC_VER +int FileDataStream::write(const std::size_t* data, std::size_t count) { - return ( (int)fwrite(data, sizeof( long ), count, stream) == count ); + return (fwrite(data, sizeof(std::size_t), count, stream) == count); } +#endif -int FileDataStream :: write(const double *data, int count) +int FileDataStream :: write(const long *data, std::size_t count) { - return ( (int)fwrite(data, sizeof( double ), count, stream) == count ); + return ( fwrite(data, sizeof( long ), count, stream) == count ); } -int FileDataStream :: write(const char *data, int count) +int FileDataStream :: write(const double *data, std::size_t count) { - return ( (int)fwrite(data, sizeof( char ), count, stream) == count ); + return ( fwrite(data, sizeof( double ), count, stream) == count ); +} + +int FileDataStream :: write(const char *data, std::size_t count) +{ + return ( fwrite(data, sizeof( char ), count, stream) == count ); } int FileDataStream :: write(bool data) { - return ( (int)fwrite(& data, sizeof( bool ), 1, stream) == 1 ); + return ( fwrite(& data, sizeof( bool ), 1, stream) == 1 ); +} + +int FileDataStream :: givePackSizeOfInt(std::size_t count) +{ + return (int) (sizeof(int)*count); } -int FileDataStream :: givePackSizeOfInt(int count) +int FileDataStream :: givePackSizeOfDouble(std::size_t count) { - return sizeof(int)*count; + return (int) (sizeof(double)*count); } -int FileDataStream :: givePackSizeOfDouble(int count) +int FileDataStream :: givePackSizeOfChar(std::size_t count) { - return sizeof(double)*count; + return (int) (sizeof(char)*count); } -int FileDataStream :: givePackSizeOfChar(int count) +int FileDataStream :: givePackSizeOfBool(std::size_t count) { - return sizeof(char)*count; + return (int) (sizeof(bool)*count); } -int FileDataStream :: givePackSizeOfBool(int count) +int FileDataStream :: givePackSizeOfLong(std::size_t count) { - return sizeof(bool)*count; + return (int) (sizeof(long)*count); } -int FileDataStream :: givePackSizeOfLong(int count) +int FileDataStream :: givePackSizeOfSizet(std::size_t count) { - return sizeof(int)*count; + return (int) (sizeof(std::size_t)*count); } } diff --git a/src/oofemlib/datastream.h b/src/oofemlib/datastream.h index 28d9ab205..224aa833c 100644 --- a/src/oofemlib/datastream.h +++ b/src/oofemlib/datastream.h @@ -35,7 +35,7 @@ #ifndef datastream_h #define datastream_h -#include "oofemcfg.h" +#include "oofemenv.h" #include #include @@ -64,19 +64,24 @@ class OOFEM_EXPORT DataStream */ //@{ /// Reads count integer values into array pointed by data. - virtual int read(int *data, int count) = 0; + virtual int read(int *data, std::size_t count) = 0; int read(int &data) { return this->read(&data, 1); } /// Reads count unsigned long values into array pointed by data. - virtual int read(unsigned long *data, int count) = 0; + virtual int read(unsigned long *data, std::size_t count) = 0; int read(unsigned long &data) { return this->read(&data, 1); } +#ifdef _MSC_VER + /// Reads count unsigned std::size_t values into array pointed by data. + virtual int read(std::size_t* data, std::size_t count) = 0; + int read(std::size_t& data) { return this->read(&data, 1); } +#endif /// Reads count long values into array pointed by data. - virtual int read(long *data, int count) = 0; + virtual int read(long *data, std::size_t count) = 0; int read(long &data) { return this->read(&data, 1); } /// Reads count double values into array pointed by data. - virtual int read(double *data, int count) = 0; + virtual int read(double *data, std::size_t count) = 0; int read(double &data) { return this->read(&data, 1); } /// Reads count char values into array pointed by data. - virtual int read(char *data, int count) = 0; + virtual int read(char *data, std::size_t count) = 0; int read(char &data) { return this->read(&data, 1); } /// Reads a bool value from data. virtual int read(bool &data) = 0; @@ -91,19 +96,24 @@ class OOFEM_EXPORT DataStream */ //@{ /// Writes count integer values from array pointed by data. - virtual int write(const int *data, int count) = 0; + virtual int write(const int *data, std::size_t count) = 0; int write(int data) { return this->write(&data, 1); } /// Writes count unsigned long values from array pointed by data. - virtual int write(const unsigned long *data, int count) = 0; + virtual int write(const unsigned long *data, std::size_t count) = 0; int write(unsigned long data) { return this->write(&data, 1); } +#ifdef _MSC_VER + /// Writes count std::size_t values from array pointed by data. + virtual int write(const std::size_t* data, std::size_t count) = 0; + int write(std::size_t data) { return this->write(&data, 1); } +#endif /// Writes count long values from array pointed by data. - virtual int write(const long *data, int count) = 0; + virtual int write(const long *data, std::size_t count) = 0; int write(long data) { return this->write(&data, 1); } /// Writes count double values from array pointed by data. - virtual int write(const double *data, int count) = 0; + virtual int write(const double *data, std::size_t count) = 0; int write(double data) { return this->write(&data, 1); } /// Writes count char values from array pointed by data. - virtual int write(const char *data, int count) = 0; + virtual int write(const char *data, std::size_t count) = 0; int write(char data) { return this->write(&data, 1); } /// Writes a bool value. virtual int write(bool data) = 0; @@ -118,11 +128,12 @@ class OOFEM_EXPORT DataStream * These methods compute the stored size (in bytes) of an array containing "count" elements. */ //@{ - virtual int givePackSizeOfInt(int count) = 0; - virtual int givePackSizeOfDouble(int count) = 0; - virtual int givePackSizeOfChar(int count) = 0; - virtual int givePackSizeOfBool(int count) = 0; - virtual int givePackSizeOfLong(int count) = 0; + virtual int givePackSizeOfInt(std::size_t count) = 0; + virtual int givePackSizeOfDouble(std::size_t count) = 0; + virtual int givePackSizeOfChar(std::size_t count) = 0; + virtual int givePackSizeOfBool(std::size_t count) = 0; + virtual int givePackSizeOfLong(std::size_t count) = 0; + virtual int givePackSizeOfSizet(std::size_t count) = 0; //@} }; @@ -155,25 +166,33 @@ class OOFEM_EXPORT FileDataStream : public DataStream /// Destructor (will not close stream!) virtual ~FileDataStream(); - int read(int *data, int count) override; - int read(unsigned long *data, int count) override; - int read(long *data, int count) override; - int read(double *data, int count) override; - int read(char *data, int count) override; + int read(int *data, std::size_t count) override; + int read(unsigned long *data, std::size_t count) override; +#ifdef _MSC_VER + int read(std::size_t *data, std::size_t count) override; +#endif + int read(long *data, std::size_t count) override; + int read(double *data, std::size_t count) override; + int read(char *data, std::size_t count) override; int read(bool &data) override; - int write(const int *data, int count) override; - int write(const unsigned long *data, int count) override; - int write(const long *data, int count) override; - int write(const double *data, int count) override; - int write(const char *data, int count) override; + int write(const int *data, std::size_t count) override; + int write(const unsigned long *data, std::size_t count) override; +#ifdef _MSC_VER + int write(const std::size_t* data, std::size_t count); +#endif + int write(const long *data, std::size_t count) override; + int write(const double *data, std::size_t count) override; + int write(const char *data, std::size_t count) override; int write(bool data) override; - int givePackSizeOfInt(int count) override; - int givePackSizeOfDouble(int count) override; - int givePackSizeOfChar(int count) override; - int givePackSizeOfBool(int count) override; - int givePackSizeOfLong(int count) override; + int givePackSizeOfInt(std::size_t count) override; + int givePackSizeOfDouble(std::size_t count) override; + int givePackSizeOfChar(std::size_t count) override; + int givePackSizeOfBool(std::size_t count) override; + int givePackSizeOfLong(std::size_t count) override; + int givePackSizeOfSizet(std::size_t count) override; + }; } // end namespace oofem diff --git a/src/oofemlib/dictionary.C b/src/oofemlib/dictionary.C index 8a4e21c96..a02913076 100644 --- a/src/oofemlib/dictionary.C +++ b/src/oofemlib/dictionary.C @@ -129,7 +129,6 @@ double Dictionary :: at(int aKey) const next = next->giveNext(); } OOFEM_ERROR("Requested key missing from dictionary"); - return 0.; } diff --git a/src/oofemlib/dictionary.h b/src/oofemlib/dictionary.h index e49deb136..b49ef484e 100644 --- a/src/oofemlib/dictionary.h +++ b/src/oofemlib/dictionary.h @@ -35,7 +35,7 @@ #ifndef dictionr_h #define dictionr_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "pair.h" #include "error.h" #include "contextioresulttype.h" diff --git a/src/oofemlib/dof.h b/src/oofemlib/dof.h index 58f1dd2f0..82fa436a3 100644 --- a/src/oofemlib/dof.h +++ b/src/oofemlib/dof.h @@ -37,7 +37,7 @@ #include -#include "oofemcfg.h" +#include "oofemenv.h" #include "floatarray.h" #include "intarray.h" #include "unknowntype.h" diff --git a/src/oofemlib/dofdistributedprimaryfield.C b/src/oofemlib/dofdistributedprimaryfield.C index 555955ad4..01647c5e1 100644 --- a/src/oofemlib/dofdistributedprimaryfield.C +++ b/src/oofemlib/dofdistributedprimaryfield.C @@ -72,7 +72,6 @@ DofDistributedPrimaryField :: giveUnknownValue(Dof *dof, ValueModeType mode, Tim return val1 - val0; } else { OOFEM_ERROR("Unknown value mode requested"); - return 0; } } diff --git a/src/oofemlib/dofdistributedprimaryfield.h b/src/oofemlib/dofdistributedprimaryfield.h index 3f550ea0c..ca547f667 100644 --- a/src/oofemlib/dofdistributedprimaryfield.h +++ b/src/oofemlib/dofdistributedprimaryfield.h @@ -85,7 +85,7 @@ class OOFEM_EXPORT DofDistributedPrimaryField : public PrimaryField void applyBoundaryCondition(TimeStep *tStep) override; void applyBoundaryCondition(BoundaryCondition &bc, TimeStep *tStep); - FloatArray *giveSolutionVector(TimeStep *tStep) override { OOFEM_ERROR("DEPRECATED"); return nullptr; } + FloatArray *giveSolutionVector(TimeStep *tStep) override { OOFEM_ERROR("DEPRECATED"); } void setInitialGuess(DofManager &dman, TimeStep *tStep, TimeStep *prev); void advanceSolution(TimeStep *tStep) override; diff --git a/src/oofemlib/dofmanager.C b/src/oofemlib/dofmanager.C index da8bfa3da..ff5acb14b 100644 --- a/src/oofemlib/dofmanager.C +++ b/src/oofemlib/dofmanager.C @@ -119,6 +119,13 @@ void DofManager :: computeLoadVector(FloatArray &answer, Load *load, CharType ty Dof *DofManager :: giveDofWithID(int dofID) const // Returns the degree of freedom of the receiver with 'dofID'. { + //printf( "Searching for DOF ID %d in DofManager %d\n", dofID, this->giveNumber() ); + + //// Print all available DOFs in this DofManager + //printf( "Available DOFs in this DofManager:\n" ); + //for ( auto it = this->begin(); it != this->end(); ++it ) { + // printf( "DOF ID: %d\n", ( *it )->giveDofID() ); + //} auto pos = this->findDofWithDofId( ( DofIDItem ) dofID ); #ifdef DEBUG @@ -195,12 +202,14 @@ void DofManager :: giveLocationArray(const IntArray &dofIDArry, IntArray &locati locationArray.clear(); for ( int dofid: dofIDArry ) { - auto pos = this->findDofWithDofId( ( DofIDItem ) dofid ); - if ( pos == this->end() ) { - OOFEM_ERROR("incompatible dof (%d) requested", dofid); - } - (*pos)->giveEquationNumbers(mstrEqNmbrs, s); - locationArray.followedBy(mstrEqNmbrs); + //if ( dofid != 5 ) { + auto pos = this->findDofWithDofId( ( DofIDItem ) dofid ); + if ( pos == this->end() ) { + OOFEM_ERROR("incompatible dof (%d) requested", dofid); + } + (*pos)->giveEquationNumbers(mstrEqNmbrs, s); + locationArray.followedBy(mstrEqNmbrs); + //} } } } @@ -834,6 +843,7 @@ void DofManager :: postInitialize() { hasSlaveDofs = false; for ( Dof *dof: *this ) { + /*printf( "Checking DOF: id=%d, primary=%d\n", dof->giveDofID(), dof->isPrimaryDof() );*/ if ( !dof->isPrimaryDof() ) { hasSlaveDofs = true; continue; diff --git a/src/oofemlib/dofmanvalfield.C b/src/oofemlib/dofmanvalfield.C index 3b43d0636..61584e848 100644 --- a/src/oofemlib/dofmanvalfield.C +++ b/src/oofemlib/dofmanvalfield.C @@ -130,15 +130,12 @@ DofManValueField::evaluateAt(FloatArray &answer, const FloatArray &coords, Value } } else { // mapping from global to local coordinates failed OOFEM_ERROR("Error in mapping from global to local coordinates\n"); - result = 1; // failed } } else { // element without interpolation OOFEM_ERROR("Error in element without interpolation\n"); - result = 1; // failed } } else { // no element containing given point found OOFEM_ERROR("Point out of defined elements\n"); - result = 1; // failed } return result; } diff --git a/src/oofemlib/domain.C b/src/oofemlib/domain.C index 18eac9a80..e30e7d70f 100644 --- a/src/oofemlib/domain.C +++ b/src/oofemlib/domain.C @@ -76,7 +76,7 @@ #include "simpleslavedof.h" #include "masterdof.h" -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE #include "parallel.h" #include "processcomm.h" #include "datastream.h" @@ -110,7 +110,7 @@ Domain :: Domain(int n, int serNum, EngngModel *e) : defaultNodeDofIDArry(), axisymm = false; freeDofID = MaxDofID; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE dmanMapInitialized = elementMapInitialized = false; transactionManager = NULL; #endif @@ -148,7 +148,7 @@ Domain :: clear() ///@todo bp: how to clear/reset topology data? topology = nullptr; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE transactionManager = nullptr; #endif } @@ -212,7 +212,6 @@ Domain :: giveElementsWithMaterialNum(int iMaterialNum) const return res->second; } else { OOFEM_ERROR("Material not found.") - return res->second; } } @@ -228,7 +227,6 @@ Domain :: giveLoad(int n) return answer; } else { OOFEM_ERROR("cannot cast boundary condition %d to Load class", n); - return NULL; } #else return static_cast< Load * >( bcList[n-1].get() ); @@ -1032,6 +1030,7 @@ Domain :: giveDefaultNodeDofIDArry() defaultNodeDofIDArry = {D_u}; } else if ( dType == _2dBeamMode ) { defaultNodeDofIDArry = {D_u, D_w, R_v}; + //defaultNodeDofIDArry = { D_u, D_v, R_v }; } else if ( dType == _2dLatticeMode ) { defaultNodeDofIDArry = {D_u, D_v, R_w}; } else if ( dType == _HeatTransferMode ) { @@ -1264,6 +1263,32 @@ Domain :: createDofs() } } + // Step 2c. THis will apply BC set to internal element nodes. + for ( int i = 1; i <= this->giveNumberOfBoundaryConditions(); ++i ) { + GeneralBoundaryCondition *gbc = this->giveBc(i); + if ( gbc->giveSetNumber() > 0 ) { ///@todo This will eventually not be optional. + // Loop over nodes in set and store the bc number in each dof. + Set *set = this->giveSet( gbc->giveSetNumber() ); + BoundaryCondition *bc = dynamic_cast< BoundaryCondition * >(gbc); + if ( bc ) { + const IntArray &appliedDofs = gbc->giveDofIDs(); + const IntArray &internalelementnodes = set->giveInternalElementDofManagerList(); + for ( int indx = 1; indx <= internalelementnodes.giveSize()/2; ++indx ) { + int ielem = internalelementnodes.at(indx*2-1); + int idofman = internalelementnodes.at(indx*2); + for ( int idof = 1; idof <= appliedDofs.giveSize(); ++idof ) { + // test if element internal dofman has the dof + DofManager* idman = this->giveElement(ielem)->giveInternalDofManager(idofman); + if (idman && idman->hasDofID((DofIDItem) appliedDofs.at(idof))) { + // assign bc to existing DOF + idman->giveDofWithID((DofIDItem) appliedDofs.at(idof))->setBcId(i); + } + } + } + } + } + } + /////////////////////////////////////////////////////////////////////////////////////////////// // Step 3. Same for initial conditions as for boundary conditions in step 2. std :: vector< std :: map< int, int > > dof_ic( this->giveNumberOfDofManagers() ); @@ -1303,14 +1328,14 @@ Domain :: createDofs() for ( int id: node_dofs [ i - 1 ] ) { // Find bc and ic if there are any, otherwise zero. int bcid = dof_bc [ i - 1 ].find(id) != dof_bc [ i - 1 ].end() ? dof_bc [ i - 1 ] [ id ] : 0; - int icid = dof_ic [ i - 1 ].find(id) != dof_ic [ i - 1 ].end() ? dof_ic [ i - 1 ] [ id ] : 0; + //int icid = dof_ic [ i - 1 ].find(id) != dof_ic [ i - 1 ].end() ? dof_ic [ i - 1 ] [ id ] : 0; // Determine the doftype: dofType dtype = DT_master; const std :: map< int, int > *dmanTypes = dman->giveDofTypeMap(); if ( dmanTypes ) { std :: map< int, int > :: const_iterator it = dmanTypes->find(id); - if ( it != dmanTypes->end() ) { + if ( it != dmanTypes->end()) { dtype = ( dofType ) it->second; } } @@ -1334,8 +1359,6 @@ Domain :: createDofs() if ( !dman->hasDofID((DofIDItem)id) ) { Dof *dof = classFactory.createDof(dtype, (DofIDItem)id, dman); - dof->setBcId(bcid); // Note: slave dofs and such will simple ignore this. - dof->setIcId(icid); // Slave dofs obtain their weights post-initialization, simple slave dofs must have their master node specified. if ( dtype == DT_simpleSlave ) { static_cast< SimpleSlaveDof * >(dof)->setMasterDofManagerNum( ( * dman->giveMasterMap() ) [ id ] ); @@ -1343,6 +1366,18 @@ Domain :: createDofs() dman->appendDof(dof); } } + // assign bc & ic data on all dofs (existing & newly created ones) + for ( Dof *dof: *dman ) { + // Find bc and ic if there are any, otherwise zero. + DofIDItem id = dof->giveDofID(); + int bcid = dof_bc [ i - 1 ].find(id) != dof_bc [ i - 1 ].end() ? dof_bc [ i - 1 ] [ id ] : 0; + int icid = dof_ic [ i - 1 ].find(id) != dof_ic [ i - 1 ].end() ? dof_ic [ i - 1 ] [ id ] : 0; + // preserve existing BC and IC if set (required for adaptivity, BC and IC set by mesher) + if (dof->isPrimaryDof()) { + if (dof->giveBcId()==0) dof->setBcId(bcid); // Note: slave dofs and such will simple ignore this. + if (dof->giveIcId()==0) dof->setIcId(icid); + } + } } // XFEM manager create additional dofs themselves: @@ -1591,7 +1626,7 @@ Domain :: restoreContext(DataStream &stream, ContextMode mode) } } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE DomainTransactionManager * Domain :: giveTransactionManager() diff --git a/src/oofemlib/domain.h b/src/oofemlib/domain.h index 0950d8307..db5c6670b 100644 --- a/src/oofemlib/domain.h +++ b/src/oofemlib/domain.h @@ -35,13 +35,13 @@ #ifndef domain_h #define domain_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "domaintype.h" #include "statecountertype.h" #include "intarray.h" #include "error.h" #include "bctracker.h" -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE #include "entityrenumberingscheme.h" #endif @@ -225,7 +225,7 @@ class OOFEM_EXPORT Domain int freeDofID; private: -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE /** * Transaction manager. The purpose of this class is to * make the domain modification (in terms of adding and deleting components) versatile. @@ -652,7 +652,7 @@ class OOFEM_EXPORT Domain */ void setSmoother(NodalRecoveryModel *newSmoother, bool destroyOld = true); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE /**@name Domain transaction support methods. * The purpose of these methods is to provide a unified approach * for changing domain at runtime (meaning mainly adding and deleting dofmanagers and elements). diff --git a/src/oofemlib/domaintransactionmanager.h b/src/oofemlib/domaintransactionmanager.h index aafeab37c..4c532f74a 100644 --- a/src/oofemlib/domaintransactionmanager.h +++ b/src/oofemlib/domaintransactionmanager.h @@ -35,7 +35,7 @@ #ifndef domaintransactionmanager_h #define domaintransactionmanager_h -#include "oofemcfg.h" +#include "oofemenv.h" #include diff --git a/src/oofemlib/dyncombuff.C b/src/oofemlib/dyncombuff.C index 4e647d989..6b6b4b5d6 100644 --- a/src/oofemlib/dyncombuff.C +++ b/src/oofemlib/dyncombuff.C @@ -40,7 +40,7 @@ #include "error.h" namespace oofem { -CommunicationPacket :: CommunicationPacket(MPI_Comm comm, int size, int num) : MPIBuffer(max(size, __CommunicationPacket_DEFAULT_SIZE), false) + CommunicationPacket :: CommunicationPacket(MPI_Comm comm, std::size_t size, int num) : MPIBuffer(max(size, __CommunicationPacket_DEFAULT_SIZE), false) { this->EOF_Flag = false; this->number = num; @@ -81,7 +81,7 @@ CommunicationPacket :: iSend(MPI_Comm communicator, int dest, int tag) int -CommunicationPacket :: iRecv(MPI_Comm communicator, int source, int tag, int count) +CommunicationPacket :: iRecv(MPI_Comm communicator, int source, int tag, std::size_t count) { if ( count ) { if ( count >= this->size ) { @@ -148,7 +148,7 @@ CommunicationPacket :: unpackHeader(MPI_Comm comm) CommunicationPacketPool DynamicCommunicationBuffer :: packetPool; -DynamicCommunicationBuffer :: DynamicCommunicationBuffer(MPI_Comm comm, int size, bool dynamic) : + DynamicCommunicationBuffer :: DynamicCommunicationBuffer(MPI_Comm comm, std::size_t size, bool dynamic) : CommunicationBuffer(comm, size, dynamic), packet_list() { number_of_packets = 0; @@ -278,7 +278,7 @@ DynamicCommunicationBuffer :: iSend(int dest, int tag) int -DynamicCommunicationBuffer :: iRecv(int source, int tag, int count) +DynamicCommunicationBuffer :: iRecv(int source, int tag, std::size_t count) { this->init(); number_of_packets = 0; diff --git a/src/oofemlib/dyncombuff.h b/src/oofemlib/dyncombuff.h index 52717bb68..65fc2ca19 100644 --- a/src/oofemlib/dyncombuff.h +++ b/src/oofemlib/dyncombuff.h @@ -67,7 +67,7 @@ class OOFEM_EXPORT CommunicationPacket : public MPIBuffer #ifdef __USE_MPI /// Constructor. Creates buffer of given size, using given communicator for packing. - CommunicationPacket(MPI_Comm comm, int size, int num); + CommunicationPacket(MPI_Comm comm, std::size_t size, int num); /// Constructor. Creates empty buffer, using given communicator for packing. CommunicationPacket(MPI_Comm comm, int num); #endif @@ -99,7 +99,7 @@ class OOFEM_EXPORT CommunicationPacket : public MPIBuffer * @param communicator Communicator request handle. * @return MIP_Succes if ok. */ - int iRecv(MPI_Comm communicator, int source, int tag, int count = 0) override; + int iRecv(MPI_Comm communicator, int source, int tag, std::size_t count = 0) override; /** * Tests if the operation identified by this->request is complete. * In such case, true is returned and @@ -175,13 +175,13 @@ class OOFEM_EXPORT DynamicCommunicationBuffer : public CommunicationBuffer bool completed; public: /// Constructor. Creates buffer of given size, using given communicator for packing. - DynamicCommunicationBuffer(MPI_Comm comm, int size, bool dynamic = 0); + DynamicCommunicationBuffer(MPI_Comm comm, std::size_t size, bool dynamic = 0); /// Constructor. Creates empty buffer, using given communicator for packing. DynamicCommunicationBuffer(MPI_Comm comm, bool dynamic = 0); /// Destructor. virtual ~DynamicCommunicationBuffer(); - int resize(int newSize) override { return 1; } + int resize(std::size_t newSize) override { return 1; } void init() override; /// Initialize for packing. @@ -189,31 +189,31 @@ class OOFEM_EXPORT DynamicCommunicationBuffer : public CommunicationBuffer /// Initialize for Unpacking (data already received). void initForUnpacking() override; - int write(const int *src, int n) override + int write(const int *src, std::size_t n) override { return __write(src, n, MPI_INT); } - int write(const long *src, int n) override + int write(const long *src, std::size_t n) override { return __write(src, n, MPI_LONG); } - int write(const unsigned long *src, int n) override + int write(const unsigned long *src, std::size_t n) override { return __write(src, n, MPI_UNSIGNED_LONG); } - int write(const double *src, int n) override + int write(const double *src, std::size_t n) override { return __write(src, n, MPI_DOUBLE); } - int write(const char *src, int n) override + int write(const char *src, std::size_t n) override { return __write(src, n, MPI_CHAR); } - int read(int *dest, int n) override + int read(int *dest, std::size_t n) override { return __read(dest, n, MPI_INT); } - int read(long *dest, int n) override + int read(long *dest, std::size_t n) override { return __read(dest, n, MPI_LONG); } - int read(unsigned long *dest, int n) override + int read(unsigned long *dest, std::size_t n) override { return __read(dest, n, MPI_UNSIGNED_LONG); } - int read(double *dest, int n) override + int read(double *dest, std::size_t n) override { return __read(dest, n, MPI_DOUBLE); } - int read(char *dest, int n) override + int read(char *dest, std::size_t n) override { return __read(dest, n, MPI_CHAR); } int iSend(int dest, int tag) override; - int iRecv(int source, int tag, int count = 0) override; + int iRecv(int source, int tag, std::size_t count = 0) override; int bcast(int root) override; /** diff --git a/src/oofemlib/element.C b/src/oofemlib/element.C index c0e3c6538..a8e3ff16a 100644 --- a/src/oofemlib/element.C +++ b/src/oofemlib/element.C @@ -347,7 +347,7 @@ Element :: computeDofTransformationMatrix(FloatMatrix &answer, const IntArray &n this->giveInternalDofManDofIDMask(i, dofIDmask); if ( !this->giveInternalDofManager( nodes.at(i) )->computeM2GTransformation(dofManT, dofIDmask) ) { dofManT.resize( dofIDmask.giveSize(), dofIDmask.giveSize() ); - dofManT.zero(); + dofManT.zero(); dofManT.beUnitMatrix(); } nc = dofManT.giveNumberOfColumns(); @@ -397,7 +397,7 @@ Element :: giveLocationArray(IntArray &locationArray, const UnknownNumberingSche for ( int i = 1; i <= this->giveNumberOfDofManagers(); i++ ) { this->giveDofManDofIDMask(i, ids); this->giveDofManager(i)->giveLocationArray(ids, nodalArray, s); - locationArray.followedBy(nodalArray); + locationArray.followedBy(nodalArray); if ( dofIdArray ) { this->giveDofManager(i)->giveMasterDofIDArray(ids, masterDofIDs); dofIdArray->followedBy(masterDofIDs); @@ -630,7 +630,6 @@ Element :: giveCharacteristicValue(CharType mtrx, TimeStep *tStep) // { OOFEM_ERROR("Unknown Type of characteristic mtrx."); - return 0.; } @@ -842,25 +841,25 @@ Element :: initForNewStep() IntArray Element::giveBoundaryEdgeNodes(int boundary) const { - return this->giveInterpolation()->boundaryEdgeGiveNodes(boundary); + return this->giveInterpolation()->boundaryEdgeGiveNodes(boundary, this->giveGeometryType()); } IntArray Element::giveBoundarySurfaceNodes(int boundary) const { - return this->giveInterpolation()->boundarySurfaceGiveNodes(boundary); + return this->giveInterpolation()->boundarySurfaceGiveNodes(boundary, this->giveGeometryType()); } std::unique_ptr Element::giveBoundaryEdgeIntegrationRule(int order, int boundary) { - return this->giveInterpolation()->giveBoundaryEdgeIntegrationRule(order, boundary); + return this->giveInterpolation()->giveBoundaryEdgeIntegrationRule(order, boundary, this->giveGeometryType()); } std::unique_ptr Element::giveBoundarySurfaceIntegrationRule(int order, int boundary) { - return this->giveInterpolation()->giveBoundarySurfaceIntegrationRule(order, boundary); + return this->giveInterpolation()->giveBoundarySurfaceIntegrationRule(order, boundary, this->giveGeometryType()); } @@ -1070,7 +1069,6 @@ Element :: computeVolume() #ifdef DEBUG if ( !fei ) { OOFEM_ERROR("Function not overloaded and necessary interpolator isn't available"); - return 0.0; } #endif return fei->giveVolume( FEIElementGeometryWrapper(this) ); @@ -1084,7 +1082,6 @@ Element :: computeArea() #ifdef DEBUG if ( !fei ) { OOFEM_ERROR("Function not overloaded and necessary interpolator isn't available"); - return 0.0; } #endif return fei->giveArea( FEIElementGeometryWrapper(this) ); @@ -1098,7 +1095,6 @@ Element :: computeLength() #ifdef DEBUG if ( !fei ) { OOFEM_ERROR("Function not overloaded and necessary interpolator isn't available"); - return 0.0; } #endif return fei->giveLength( FEIElementGeometryWrapper(this) ); @@ -1370,7 +1366,6 @@ Element :: giveSpatialDimension() } OOFEM_ERROR("failure (maybe new element type was registered)"); - return 0; //to make compiler happy } @@ -1417,7 +1412,6 @@ Element :: giveNumberOfBoundarySides() OOFEM_ERROR("failure, unsupported geometry type (%s)", __Element_Geometry_TypeToString( this->giveGeometryType() )); - return 0; // to make compiler happy } @@ -1512,17 +1506,18 @@ integrationDomain Element :: giveIntegrationDomain() const { FEInterpolation *fei = this->giveInterpolation(); - return fei ? fei->giveIntegrationDomain() : _UnknownIntegrationDomain; + return fei ? fei->giveIntegrationDomain(this->giveGeometryType()) : _UnknownIntegrationDomain; } - +/* Element_Geometry_Type Element :: giveGeometryType() const { - FEInterpolation *fei = this->giveInterpolation(); - return fei ? fei->giveGeometryType() : EGT_unknown; + return EGT_unknown; + //FEInterpolation *fei = this->giveInterpolation(); + //return fei ? fei->giveGeometryType() : EGT_unknown; } - +*/ bool Element :: computeGtoLRotationMatrix(FloatMatrix &answer) diff --git a/src/oofemlib/element.h b/src/oofemlib/element.h index b7ef0f891..ea56d32fe 100644 --- a/src/oofemlib/element.h +++ b/src/oofemlib/element.h @@ -237,7 +237,6 @@ class OOFEM_EXPORT Element : public FEMComponent */ virtual DofManager *giveInternalDofManager(int i) const { OOFEM_ERROR("No such DOF available on Element %d", number); - return NULL; } //@} /** @@ -808,7 +807,7 @@ class OOFEM_EXPORT Element : public FEMComponent * it is required only for some specialized tasks. * @return Geometry type of element. */ - virtual Element_Geometry_Type giveGeometryType() const; + virtual Element_Geometry_Type giveGeometryType() const = 0; /** * Returns the element spatial dimension (1, 2, or 3). * This is completely based on the geometrical shape, so a plane in space counts as 2 dimensions. @@ -885,7 +884,7 @@ class OOFEM_EXPORT Element : public FEMComponent * @param normalToCrackPlane Normal to the expected crack band. * @return Element size corresponding to the given direction (expected width of the crack band). */ - virtual double giveCharacteristicLength(const FloatArray &normalToCrackPlane) { OOFEM_ERROR("Function not overloaded, which probably means that the crack band approach should not be used for this element"); return 0.; } + virtual double giveCharacteristicLength(const FloatArray &normalToCrackPlane) { OOFEM_ERROR("Function not overloaded, which probably means that the crack band approach should not be used for this element"); } /** * Returns the size of element in the given direction if the direction is in the XY plane, * otherwise gives the mean size defined as the square root of the element area. diff --git a/src/oofemlib/engngm.C b/src/oofemlib/engngm.C index c44034131..c4c640ea2 100644 --- a/src/oofemlib/engngm.C +++ b/src/oofemlib/engngm.C @@ -39,6 +39,7 @@ #include "nummet.h" #include "sparsemtrx.h" #include "engngm.h" +#include "oofemcfg.h" #include "timestep.h" #include "metastep.h" #include "element.h" @@ -47,7 +48,7 @@ #include "bodyload.h" #include "boundaryload.h" #include "nodalload.h" -#include "oofemcfg.h" +#include "oofemenv.h" #include "timer.h" #include "dofmanager.h" #include "node.h" @@ -71,7 +72,7 @@ #include "contact/contactmanager.h" -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE #include "problemcomm.h" #include "processcomm.h" #include "loadbalancer.h" @@ -127,7 +128,7 @@ EngngModel :: EngngModel(int i, EngngModel *_master) : domainNeqs(), domainPresc numProcs = 1; rank = 0; nonlocalExt = 0; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE loadBalancingFlag = false; force_load_rebalance_in_first_step = false; lb = NULL; @@ -154,7 +155,7 @@ EngngModel :: ~EngngModel() fclose(outputStream); } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE delete communicator; delete nonlocCommunicator; delete commBuff; @@ -290,7 +291,7 @@ EngngModel :: initializeFrom(InputRecord &ir) IR_GIVE_OPTIONAL_FIELD(ir, parallelFlag, _IFT_EngngModel_parallelflag); // fprintf (stderr, "Parallel mode is %d\n", parallelFlag); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE /* Load balancing support */ _val = 0; IR_GIVE_OPTIONAL_FIELD(ir, _val, _IFT_EngngModel_loadBalancingFlag); @@ -317,7 +318,7 @@ EngngModel :: initializeFrom(InputRecord &ir) fprintf(outputStream, "\nStarting analysis on: %s\n", ctime(& this->startTime) ); fprintf(outputStream, "%s\n", simulationDescription.c_str()); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( this->isParallel() ) { fprintf(outputStream, "Problem rank is %d/%d on %s\n\n", this->rank, this->numProcs, this->processor_name); } @@ -488,6 +489,15 @@ EngngModel :: forceEquationNumbering() return this->numberOfEquations; } +void +EngngModel::initializeYourself (TimeStep *tStep) +{ + // needed only of BCs are changing, no way to get this information now + // so to be safe, we alvays reinitialize + for ( auto &domain: domainList ) { + domain->giveBCTracker()->initialize(); + } +} void EngngModel :: solveYourself() @@ -539,7 +549,7 @@ EngngModel :: solveYourself() this->giveCurrentStep()->giveNumber(), _steptime); } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( loadBalancingFlag ) { this->balanceLoad( this->giveCurrentStep() ); } @@ -588,7 +598,7 @@ EngngModel :: updateAttributes(MetaStep *mStep) this->giveNumericalMethod(mStep1)->initializeFrom(ir); } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( this->giveLoadBalancer() ) { this->giveLoadBalancer()->initializeFrom(ir); } @@ -894,7 +904,7 @@ void EngngModel :: assemble(SparseMtrx &answer, TimeStep *tStep, const MatrixAss ma.matrixFromSurfaceLoad(mat, *element, sLoad, boundary, tStep); if ( mat.isNotEmpty() ) { - bNodes = element->giveInterpolation()->boundaryGiveNodes(boundary); + bNodes = element->giveInterpolation()->boundaryGiveNodes(boundary, element->giveGeometryType()); if ( element->computeDofTransformationMatrix(R, bNodes, true) ) { mat.rotatedWith(R); } @@ -919,7 +929,7 @@ void EngngModel :: assemble(SparseMtrx &answer, TimeStep *tStep, const MatrixAss ma.matrixFromEdgeLoad(mat, *element, eLoad, boundary, tStep); if ( mat.isNotEmpty() ) { - bNodes = element->giveInterpolation()->boundaryEdgeGiveNodes(boundary); + bNodes = element->giveInterpolation()->boundaryEdgeGiveNodes(boundary, element->giveGeometryType()); if ( element->computeDofTransformationMatrix(R, bNodes, true) ) { mat.rotatedWith(R); } @@ -1027,7 +1037,7 @@ void EngngModel :: assembleVector(FloatArray &answer, TimeStep *tStep, { if ( eNorms ) { int maxdofids = domain->giveMaxDofID(); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( this->isParallel() ) { int val; MPI_Allreduce(& maxdofids, & val, 1, MPI_INT, MPI_MAX, this->comm); @@ -1846,7 +1856,7 @@ EngngModel :: giveDomain(int i) OOFEM_ERROR("Undefined domain"); } - return NULL; + // return NULL; } void @@ -1891,7 +1901,7 @@ EngngModel :: giveMetaStep(int i) OOFEM_ERROR("undefined metaStep (%d)", i); } - return NULL; + // return NULL; } void @@ -2062,7 +2072,7 @@ void EngngModel :: drawNodes(oofegGraphicContext &gc) void EngngModel :: initializeCommMaps(bool forceInit) { -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE // Set up communication patterns. communicator->setUpCommunicationMaps(this, true, forceInit); if ( nonlocalExt ) { @@ -2078,7 +2088,7 @@ int EngngModel :: updateSharedDofManagers(FloatArray &answer, const UnknownNumberingScheme &s, int ExchangeTag) { if ( isParallel() ) { -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE int result = 1; #ifdef __VERBOSE_PARALLEL VERBOSEPARALLEL_PRINT( "EngngModel :: updateSharedDofManagers", "Packing data", this->giveRank() ); @@ -2104,7 +2114,6 @@ EngngModel :: updateSharedDofManagers(FloatArray &answer, const UnknownNumbering return result; #else OOFEM_ERROR("Support for parallel mode not compiled in."); - return 0; #endif } else { return 1; @@ -2118,7 +2127,7 @@ EngngModel :: exchangeRemoteElementData(int ExchangeTag) { if ( isParallel() && nonlocalExt ) { -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE int result = 1; #ifdef __VERBOSE_PARALLEL VERBOSEPARALLEL_PRINT( "EngngModel :: exchangeRemoteElementData", "Packing remote element data", this->giveRank() ); @@ -2144,14 +2153,13 @@ EngngModel :: exchangeRemoteElementData(int ExchangeTag) return result; #else OOFEM_ERROR("Support for parallel mode not compiled in."); - return 0; #endif } else { return 1; } } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE void EngngModel :: balanceLoad(TimeStep *tStep) { diff --git a/src/oofemlib/engngm.h b/src/oofemlib/engngm.h index 997b72789..54c847752 100644 --- a/src/oofemlib/engngm.h +++ b/src/oofemlib/engngm.h @@ -35,7 +35,7 @@ #ifndef engngm_h #define engngm_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "inputrecord.h" #include "intarray.h" #include "fieldmanager.h" @@ -58,8 +58,11 @@ #include "exportmodulemanager.h" #include "initmodulemanager.h" #include "monitormanager.h" +#ifdef __MPM_MODULE +#include "../mpm/integral.h" +#endif -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE #include "parallel.h" #endif @@ -283,14 +286,13 @@ class OOFEM_EXPORT EngngModel int numProcs; /// Flag indicating if nonlocal extension active, which will cause data to be sent between shared elements before computing the internal forces. int nonlocalExt; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE /// Processor name. char processor_name [ PROCESSOR_NAME_LENGTH ]; #ifdef __USE_MPI /// Communication object for this engineering model. MPI_Comm comm; #endif - /**@name Load balancing attributes */ //@{ /// Load Balancer. @@ -309,6 +311,10 @@ class OOFEM_EXPORT EngngModel /// NonLocal Communicator. Necessary when nonlocal constitutive models are used. ProblemCommunicator *nonlocCommunicator; +#endif +#ifdef __MPM_MODULE + /// experimental mpm + std :: vector < std :: unique_ptr< Integral > > integralList; #endif /// Message tags enum { InternalForcesExchangeTag, MassExchangeTag, LoadExchangeTag, ReactionExchangeTag, RemoteElementExchangeTag }; @@ -484,7 +490,7 @@ class OOFEM_EXPORT EngngModel * somewhere from solveYourselfAt function). Implementation must be provided. * Default implementation is empty. */ - virtual void initializeYourself(TimeStep *tStep) { } + virtual void initializeYourself(TimeStep *tStep); /** * Initializes the newly generated discretization state according to previous solution. * This process should typically include restoring old solution, instanciating newly @@ -549,7 +555,7 @@ class OOFEM_EXPORT EngngModel */ virtual int giveCurrentNumberOfIterations() {return 1;} -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE /// Returns the communication object of reciever. MPI_Comm giveParallelComm() { return this->comm; } /** @@ -998,6 +1004,23 @@ class OOFEM_EXPORT EngngModel void assembleVectorFromContacts(FloatArray &answer, TimeStep *tStep, CharType type, ValueModeType mode, const UnknownNumberingScheme &s, Domain *domain, FloatArray *eNorms = NULL); +#ifdef __MPM_MODULE + /// mpm experimental + std :: vector < std :: unique_ptr< Integral > > & giveIntegralList() { + return this->integralList; + } + void addIntegral (std :: unique_ptr< Integral > obj) { + integralList.push_back(std::move(obj)); + } + // Needed for some of the boost-python bindings. NOTE: This takes ownership of the pointers, so it's actually completely unsafe. + void py_addIntegral(Integral *obj) { + int size = integralList.size(); + integralList.resize(size+1); + integralList[size].reset(obj); + } + // end mpm experimental +#endif + protected: /** * Packs receiver data when rebalancing load. When rebalancing happens, the local numbering will be lost on majority of processors. @@ -1124,7 +1147,7 @@ class OOFEM_EXPORT EngngModel * @return Upper bound of space needed. */ virtual int estimateMaxPackSize(IntArray &commMap, DataStream &buff, int packUnpackType) { return 0; } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE /** * Recovers the load balance between processors, if needed. Uses load balancer monitor and load balancer * instances to decide if rebalancing is needed (monitor) and to repartition the domain (load balancer). diff --git a/src/oofemlib/entityrenumberingscheme.h b/src/oofemlib/entityrenumberingscheme.h index c78b608c8..821f3efa0 100644 --- a/src/oofemlib/entityrenumberingscheme.h +++ b/src/oofemlib/entityrenumberingscheme.h @@ -38,7 +38,7 @@ #include #include -#include "oofemcfg.h" +#include "oofemenv.h" #include "error.h" namespace oofem { @@ -60,7 +60,10 @@ class OOFEM_EXPORT EntityRenumberingFunctor // two possible functions to call member function. virtual cause derived // classes will use a pointer to an object and a pointer to a member function // to make the function call - /// Call using operator. + /** + * Call using operator. + * @return New number of component. Throws std::out_of_range if not found. + */ virtual int operator() (int, EntityRenumberingScheme) = 0; /// Call using function. virtual int call(int, EntityRenumberingScheme) = 0; @@ -121,9 +124,8 @@ class OOFEM_EXPORT MapBasedEntityRenumberingFunctor : public EntityRenumberingFu } else { OOFEM_ERROR("unsupported EntityRenumberingScheme"); } - - OOFEM_ERROR("component label %d not found", n); - return 0; + throw std::out_of_range("entry not found"); + //OOFEM_ERROR("component label %d not found", n); } int call(int n, EntityRenumberingScheme ers) override diff --git a/src/oofemlib/errorcheckingexportmodule.C b/src/oofemlib/errorcheckingexportmodule.C index 6afcbb43a..8054e39f1 100644 --- a/src/oofemlib/errorcheckingexportmodule.C +++ b/src/oofemlib/errorcheckingexportmodule.C @@ -888,7 +888,6 @@ ErrorCheckingExportModule :: giveErrorCheck(std :: ifstream &stream, double erro return std::make_unique(line, errorTolerance); } else { OOFEM_ERROR("Unsupported rule '%s'", line.c_str()); - return nullptr; } } diff --git a/src/oofemlib/exportmodule.C b/src/oofemlib/exportmodule.C index 68d2f6c7f..ac246289b 100644 --- a/src/oofemlib/exportmodule.C +++ b/src/oofemlib/exportmodule.C @@ -115,7 +115,6 @@ Set *ExportModule :: giveRegionSet(int i) return emodel->giveDomain(1)->giveSet(setid); } else { OOFEM_ERROR ("Bad set index"); - return & this->defaultElementSet; } } } diff --git a/src/oofemlib/exportmodule.h b/src/oofemlib/exportmodule.h index 4f449ce1b..5ec94dd90 100644 --- a/src/oofemlib/exportmodule.h +++ b/src/oofemlib/exportmodule.h @@ -35,7 +35,7 @@ #ifndef exportmodule_h #define exportmodule_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "intarray.h" #include "inputrecord.h" #include "range.h" diff --git a/src/oofemlib/fei1dhermite.h b/src/oofemlib/fei1dhermite.h index 5b35f7d14..8a73df529 100644 --- a/src/oofemlib/fei1dhermite.h +++ b/src/oofemlib/fei1dhermite.h @@ -50,8 +50,8 @@ class OOFEM_EXPORT FEI1dHermite : public FEInterpolation1d public: FEI1dHermite(int coordIndx) : FEInterpolation1d(2), cindx(coordIndx) { } - integrationDomain giveIntegrationDomain() const override { return _Line; } - Element_Geometry_Type giveGeometryType() const override { return EGT_line_1; } + integrationDomain giveIntegrationDomain(const Element_Geometry_Type) const override { return _Line; } + const Element_Geometry_Type giveGeometryType() const override { return EGT_line_1; } double giveLength(const FEICellGeometry &cellgeo) const override; @@ -65,7 +65,7 @@ class OOFEM_EXPORT FEI1dHermite : public FEInterpolation1d int global2local(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; double giveTransformationJacobian(const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; - int giveNumberOfNodes() const override { return 2; } + int giveNumberOfNodes(const Element_Geometry_Type) const override { return 2; } }; } // end namespace oofem #endif diff --git a/src/oofemlib/fei1dlin.C b/src/oofemlib/fei1dlin.C index 69e4088e1..fed8da1b8 100644 --- a/src/oofemlib/fei1dlin.C +++ b/src/oofemlib/fei1dlin.C @@ -108,7 +108,7 @@ FEI1dLin :: giveTransformationJacobian(const FloatArray &lcoords, const FEICellG return 0.5 * ( cellgeo.giveVertexCoordinates(2).at(cindx) - cellgeo.giveVertexCoordinates(1).at(cindx) ); } -IntArray FEI1dLin :: boundaryEdgeGiveNodes(int boundary) const +IntArray FEI1dLin :: boundaryEdgeGiveNodes(int boundary, Element_Geometry_Type egt) const { return {1, 2}; } diff --git a/src/oofemlib/fei1dlin.h b/src/oofemlib/fei1dlin.h index 8f10b5b62..14507bb1b 100644 --- a/src/oofemlib/fei1dlin.h +++ b/src/oofemlib/fei1dlin.h @@ -49,11 +49,11 @@ class OOFEM_EXPORT FEI1dLin : public FEInterpolation1d public: FEI1dLin(int coordIndx) : FEInterpolation1d(1), cindx(coordIndx) { } - integrationDomain giveIntegrationDomain() const override { return _Line; } - Element_Geometry_Type giveGeometryType() const override { return EGT_line_1; } - integrationDomain giveBoundaryIntegrationDomain(int ib) const override { return _Point; } - integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf) const override { return _UnknownIntegrationDomain; } - integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge) const override { return _UnknownIntegrationDomain; } + integrationDomain giveIntegrationDomain(const Element_Geometry_Type) const override { return _Line; } + const Element_Geometry_Type giveGeometryType() const override { return EGT_line_1; } + integrationDomain giveBoundaryIntegrationDomain(int ib,const Element_Geometry_Type) const override { return _Point; } + integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf, const Element_Geometry_Type) const override { return _UnknownIntegrationDomain; } + integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge, const Element_Geometry_Type) const override { return _UnknownIntegrationDomain; } double giveLength(const FEICellGeometry &cellgeo) const override; @@ -66,9 +66,9 @@ class OOFEM_EXPORT FEI1dLin : public FEInterpolation1d int global2local(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; double giveTransformationJacobian(const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; - int giveNumberOfNodes() const override { return 2; } + int giveNumberOfNodes(Element_Geometry_Type) const override { return 2; } - IntArray boundaryEdgeGiveNodes(int boundary) const override; + IntArray boundaryEdgeGiveNodes(int boundary,Element_Geometry_Type) const override; void boundaryEdgeEvalN(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; double boundaryEdgeGiveTransformationJacobian(int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; void boundaryEdgeLocal2Global(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; diff --git a/src/oofemlib/fei1dquad.C b/src/oofemlib/fei1dquad.C index 52c1c30ae..07ed082cb 100644 --- a/src/oofemlib/fei1dquad.C +++ b/src/oofemlib/fei1dquad.C @@ -162,7 +162,7 @@ FEI1dQuad :: giveLength(const FEICellGeometry &cellgeo) const } -IntArray FEI1dQuad :: boundaryEdgeGiveNodes(int boundary) const +IntArray FEI1dQuad :: boundaryEdgeGiveNodes(int boundary, Element_Geometry_Type egt) const { return {1, 2, 3}; } diff --git a/src/oofemlib/fei1dquad.h b/src/oofemlib/fei1dquad.h index b6b3e51f3..3a5c3048d 100644 --- a/src/oofemlib/fei1dquad.h +++ b/src/oofemlib/fei1dquad.h @@ -49,11 +49,11 @@ class OOFEM_EXPORT FEI1dQuad : public FEInterpolation1d public: FEI1dQuad(int coordIndx) : FEInterpolation1d(2), cindx(coordIndx) { } - integrationDomain giveIntegrationDomain() const override { return _Line; } - Element_Geometry_Type giveGeometryType() const override { return EGT_line_2; } - integrationDomain giveBoundaryIntegrationDomain(int ib) const override { return _Point; } - integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf) const override { return _UnknownIntegrationDomain; } - integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge) const override { return _UnknownIntegrationDomain; } + integrationDomain giveIntegrationDomain(const Element_Geometry_Type) const override { return _Line; } + const Element_Geometry_Type giveGeometryType() const override { return EGT_line_2; } + integrationDomain giveBoundaryIntegrationDomain(int ib, const Element_Geometry_Type) const override { return _Point; } + integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf, const Element_Geometry_Type) const override { return _UnknownIntegrationDomain; } + integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge, const Element_Geometry_Type) const override { return _UnknownIntegrationDomain; } double giveLength(const FEICellGeometry &cellgeo) const override; @@ -66,9 +66,9 @@ class OOFEM_EXPORT FEI1dQuad : public FEInterpolation1d int global2local(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; double giveTransformationJacobian(const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; - int giveNumberOfNodes() const override { return 3; } + int giveNumberOfNodes(const Element_Geometry_Type) const override { return 3; } - IntArray boundaryEdgeGiveNodes(int boundary) const override; + IntArray boundaryEdgeGiveNodes(int boundary, const Element_Geometry_Type) const override; void boundaryEdgeEvalN(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; double boundaryEdgeGiveTransformationJacobian(int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; void boundaryEdgeLocal2Global(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; diff --git a/src/oofemlib/fei2dlinehermite.C b/src/oofemlib/fei2dlinehermite.C index 4accfcca1..3bcf5de55 100644 --- a/src/oofemlib/fei2dlinehermite.C +++ b/src/oofemlib/fei2dlinehermite.C @@ -142,9 +142,9 @@ double FEI2dLineHermite :: giveTransformationJacobian(const FloatArray &lcoords, return sqrt(x2_x1 * x2_x1 + y2_y1 * y2_y1) * 0.5; } -std::unique_ptr FEI2dLineHermite :: giveIntegrationRule(int order) const +std::unique_ptr FEI2dLineHermite :: giveIntegrationRule(int order, Element_Geometry_Type egt) const { OOFEM_ERROR("Not supported."); - return nullptr; + //return nullptr; } } // end namespace oofem diff --git a/src/oofemlib/fei2dlinehermite.h b/src/oofemlib/fei2dlinehermite.h index 4ac121f0a..ce06169df 100644 --- a/src/oofemlib/fei2dlinehermite.h +++ b/src/oofemlib/fei2dlinehermite.h @@ -49,12 +49,12 @@ class OOFEM_EXPORT FEI2dLineHermite : public FEInterpolation2d public: FEI2dLineHermite(int ind1, int ind2) : FEInterpolation2d(1, ind1, ind2) { } - integrationDomain giveIntegrationDomain() const override { return _Line; } - Element_Geometry_Type giveGeometryType() const override { return EGT_line_1; } + integrationDomain giveIntegrationDomain(const Element_Geometry_Type) const override { return _Line; } + const Element_Geometry_Type giveGeometryType() const override { return EGT_line_1; } - integrationDomain giveBoundaryIntegrationDomain(int ib) const override { return _Point; } - integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf) const override { return _UnknownIntegrationDomain; } - integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge) const override { return _UnknownIntegrationDomain; } + integrationDomain giveBoundaryIntegrationDomain(int ib, const Element_Geometry_Type) const override { return _Point; } + integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf, const Element_Geometry_Type) const override { return _UnknownIntegrationDomain; } + integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge, const Element_Geometry_Type) const override { return _UnknownIntegrationDomain; } double giveArea(const FEICellGeometry &cellgeo) const override { return 0.0; } @@ -77,9 +77,9 @@ class OOFEM_EXPORT FEI2dLineHermite : public FEInterpolation2d void edgeLocal2global(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override { } - int giveNumberOfNodes() const override { return 2; } + int giveNumberOfNodes(const Element_Geometry_Type) const override { return 2; } - std::unique_ptr giveIntegrationRule(int order) const override; + std::unique_ptr giveIntegrationRule(int order, const Element_Geometry_Type) const override; }; } // end namespace oofem #endif // fei2dlinehermite_h diff --git a/src/oofemlib/fei2dlinelin.C b/src/oofemlib/fei2dlinelin.C index 7e65e6141..2b3b3e49a 100644 --- a/src/oofemlib/fei2dlinelin.C +++ b/src/oofemlib/fei2dlinelin.C @@ -130,7 +130,7 @@ double FEI2dLineLin :: giveTransformationJacobian(const FloatArray &lcoords, con return sqrt(x2_x1 * x2_x1 + y2_y1 * y2_y1) / 2.0; } -IntArray FEI2dLineLin :: boundaryEdgeGiveNodes(int boundary) const +IntArray FEI2dLineLin :: boundaryEdgeGiveNodes(int boundary, Element_Geometry_Type egt) const { return {1, 2}; } @@ -169,7 +169,7 @@ double FEI2dLineLin :: evalNXIntegral(int iEdge, const FEICellGeometry &cellgeo) return x2 * y1 - x1 * y2; } -std::unique_ptr FEI2dLineLin :: giveIntegrationRule(int order) const +std::unique_ptr FEI2dLineLin :: giveIntegrationRule(int order, Element_Geometry_Type egt) const { auto iRule = std::make_unique(1, nullptr); int points = iRule->getRequiredNumberOfIntegrationPoints(_Line, order + 0); diff --git a/src/oofemlib/fei2dlinelin.h b/src/oofemlib/fei2dlinelin.h index 40ebab04b..966d499ed 100644 --- a/src/oofemlib/fei2dlinelin.h +++ b/src/oofemlib/fei2dlinelin.h @@ -48,18 +48,20 @@ class OOFEM_EXPORT FEI2dLineLin : public FEInterpolation2d public: FEI2dLineLin(int ind1, int ind2) : FEInterpolation2d(1, ind1, ind2) { } - integrationDomain giveIntegrationDomain() const override { return _Line; } - Element_Geometry_Type giveGeometryType() const override { return EGT_line_1; } - integrationDomain giveBoundaryIntegrationDomain(int ib) const override { return _Point; } - integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf) const override { return _UnknownIntegrationDomain; } - integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge) const override { return _Line; } + integrationDomain giveIntegrationDomain(const Element_Geometry_Type) const override { return _Line; } + const Element_Geometry_Type giveGeometryType() const override { return EGT_line_1; } + integrationDomain giveBoundaryIntegrationDomain(int ib, const Element_Geometry_Type) const override { return _Point; } + integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf, const Element_Geometry_Type) const override { return _UnknownIntegrationDomain; } + integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge, const Element_Geometry_Type) const override { return _Line; } double giveArea(const FEICellGeometry &cellgeo) const override { return 0.0; } void local2global(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; int global2local(FloatArray &answer, const FloatArray &gcoords, const FEICellGeometry &cellgeo) const override; - int giveNumberOfEdges() const override { return 1; } + int giveNumberOfEdges(const Element_Geometry_Type) const override { return 1; } + void giveCellDofMans(IntArray& nodes, IntArray& internalDofMans, Element* elem) const override {nodes={1,2};internalDofMans={};} + // "Bulk" static FloatArrayF<2> evalN(double xi); @@ -70,7 +72,7 @@ class OOFEM_EXPORT FEI2dLineLin : public FEInterpolation2d double giveTransformationJacobian(const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; // Edge (same as bulk for this type, so they are all ignored) (perhaps do it the other way around?). - IntArray boundaryEdgeGiveNodes(int boundary) const override; + IntArray boundaryEdgeGiveNodes(int boundary, const Element_Geometry_Type) const override; IntArray computeLocalEdgeMapping(int iedge) const override; void edgeEvalN(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; double edgeEvalNormal(FloatArray &normal, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; @@ -78,9 +80,9 @@ class OOFEM_EXPORT FEI2dLineLin : public FEInterpolation2d void edgeLocal2global(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override { } double evalNXIntegral(int iEdge, const FEICellGeometry &cellgeo) const override; - int giveNumberOfNodes() const override { return 2; } + int giveNumberOfNodes(const Element_Geometry_Type) const override { return 2; } - std::unique_ptr giveIntegrationRule(int order) const override; + std::unique_ptr giveIntegrationRule(int order, const Element_Geometry_Type) const override; protected: double edgeComputeLength(const IntArray &edgeNodes, const FEICellGeometry &cellgeo) const; diff --git a/src/oofemlib/fei2dlinequad.C b/src/oofemlib/fei2dlinequad.C index 79e44633f..face18746 100644 --- a/src/oofemlib/fei2dlinequad.C +++ b/src/oofemlib/fei2dlinequad.C @@ -237,7 +237,7 @@ void FEI2dLineQuad :: giveJacobianMatrixAt(FloatMatrix &jacobianMatrix, const Fl double FEI2dLineQuad :: edgeComputeLength(const IntArray &edgeNodes, const FEICellGeometry &cellgeo) const { OOFEM_ERROR("Not implemented"); - return 0.0; + //return 0.0; } double FEI2dLineQuad :: evalNXIntegral(int iEdge, const FEICellGeometry &cellgeo) const @@ -257,7 +257,7 @@ double FEI2dLineQuad :: evalNXIntegral(int iEdge, const FEICellGeometry &cellgeo return ( x1 * y2 - x2 * y1 + 4 * ( x3 * ( y1 - y2 ) + y3 * ( x2 - x1 ) ) ) / 3.0; } -std::unique_ptr FEI2dLineQuad :: giveIntegrationRule(int order) const +std::unique_ptr FEI2dLineQuad :: giveIntegrationRule(int order, Element_Geometry_Type egt) const { auto iRule = std::make_unique(1, nullptr); int points = iRule->getRequiredNumberOfIntegrationPoints(_Line, order + 1); diff --git a/src/oofemlib/fei2dlinequad.h b/src/oofemlib/fei2dlinequad.h index ac93ea8ca..790658030 100644 --- a/src/oofemlib/fei2dlinequad.h +++ b/src/oofemlib/fei2dlinequad.h @@ -48,18 +48,18 @@ class OOFEM_EXPORT FEI2dLineQuad : public FEInterpolation2d public: FEI2dLineQuad(int ind1, int ind2) : FEInterpolation2d(2, ind1, ind2) { } - integrationDomain giveIntegrationDomain() const override { return _Line; } - Element_Geometry_Type giveGeometryType() const override { return EGT_line_2; } - integrationDomain giveBoundaryIntegrationDomain(int ib) const override { return _Line; } - integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf) const override { return _Square; } - integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge) const override { return _Line; } + integrationDomain giveIntegrationDomain(const Element_Geometry_Type) const override { return _Line; } + const Element_Geometry_Type giveGeometryType() const override { return EGT_line_2; } + integrationDomain giveBoundaryIntegrationDomain(int ib, const Element_Geometry_Type) const override { return _Line; } + integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf, const Element_Geometry_Type) const override { return _Square; } + integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge, const Element_Geometry_Type) const override { return _Line; } double giveArea(const FEICellGeometry &cellgeo) const override { return 0.0; } void local2global(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; int global2local(FloatArray &answer, const FloatArray &gcoords, const FEICellGeometry &cellgeo) const override; - int giveNumberOfEdges() const override { return 1; } + int giveNumberOfEdges(const Element_Geometry_Type) const override { return 1; } // "Bulk" void evalN(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; @@ -76,9 +76,9 @@ class OOFEM_EXPORT FEI2dLineQuad : public FEInterpolation2d void edgeLocal2global(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; double evalNXIntegral(int iEdge, const FEICellGeometry &cellgeo) const override; - int giveNumberOfNodes() const override { return 3; } + int giveNumberOfNodes(const Element_Geometry_Type) const override { return 3; } - std::unique_ptr giveIntegrationRule(int order) const override; + std::unique_ptr giveIntegrationRule(int order, const Element_Geometry_Type) const override; protected: double edgeComputeLength(const IntArray &edgeNodes, const FEICellGeometry &cellgeo) const; diff --git a/src/oofemlib/fei2dquadbiquad.C b/src/oofemlib/fei2dquadbiquad.C index f3f2e8e7e..a951627ac 100644 --- a/src/oofemlib/fei2dquadbiquad.C +++ b/src/oofemlib/fei2dquadbiquad.C @@ -169,7 +169,7 @@ FEI2dQuadBiQuad :: evaldNdxi(FloatMatrix &dN, const FloatArray &lc, const FEICel std::pair> -FEI2dQuadBiQuad :: evaldNdx(const FloatArrayF<2> &lcoords, const FEICellGeometry &cellgeo) const +FEI2dQuadBiQuad :: _evaldNdx(const FloatArrayF<2> &lcoords, const FEICellGeometry &cellgeo) const { auto dn = evaldNdxi(lcoords); FloatMatrixF<2,2> jacT; @@ -189,7 +189,7 @@ FEI2dQuadBiQuad :: evaldNdx(const FloatArrayF<2> &lcoords, const FEICellGeometry } -std::unique_ptr FEI2dQuadBiQuad :: giveIntegrationRule(int order) const +std::unique_ptr FEI2dQuadBiQuad :: giveIntegrationRule(int order, Element_Geometry_Type egt) const { auto iRule = std::make_unique(1, nullptr); int points = iRule->getRequiredNumberOfIntegrationPoints(_Square, order + 6); diff --git a/src/oofemlib/fei2dquadbiquad.h b/src/oofemlib/fei2dquadbiquad.h index 2ae09f65b..fb7480f1c 100644 --- a/src/oofemlib/fei2dquadbiquad.h +++ b/src/oofemlib/fei2dquadbiquad.h @@ -61,12 +61,12 @@ class OOFEM_EXPORT FEI2dQuadBiQuad : public FEI2dQuadQuad static FloatArrayF<9> evalN(const FloatArrayF<2> &lcoords); static FloatMatrixF<2,9> evaldNdxi(const FloatArrayF<2> &lcoords); - std::pair> evaldNdx(const FloatArrayF<2> &lcoords, const FEICellGeometry &cellgeo) const; + std::pair> _evaldNdx(const FloatArrayF<2> &lcoords, const FEICellGeometry &cellgeo) const; void evalN(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; void evaldNdxi(FloatMatrix &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; - int giveNumberOfNodes() const override { return 9; } - std::unique_ptr giveIntegrationRule(int order) const override; + int giveNumberOfNodes(const Element_Geometry_Type) const override { return 9; } + std::unique_ptr giveIntegrationRule(int order, const Element_Geometry_Type) const override; }; } // end namespace oofem #endif // fei2dquadbiquad_h diff --git a/src/oofemlib/fei2dquadconst.C b/src/oofemlib/fei2dquadconst.C index 071e9a6e5..a20435b9a 100644 --- a/src/oofemlib/fei2dquadconst.C +++ b/src/oofemlib/fei2dquadconst.C @@ -98,7 +98,7 @@ FEI2dQuadConst :: edgeEvalN(FloatArray &answer, int iedge, const FloatArray &lco double FEI2dQuadConst :: edgeEvalNormal(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const { OOFEM_ERROR("not implemented"); - return 0.; + //return 0.; } void @@ -126,7 +126,7 @@ FEI2dQuadConst :: computeLocalEdgeMapping(int iedge) const return {3, 1}; } else { throw std::range_error("invalid egde number"); - return {}; + //return {}; } } @@ -142,7 +142,7 @@ FEI2dQuadConst :: edgeComputeLength(const IntArray &edgeNodes, const FEICellGeom } std::unique_ptr -FEI2dQuadConst :: giveIntegrationRule(int order) const +FEI2dQuadConst :: giveIntegrationRule(int order, Element_Geometry_Type egt) const { auto iRule = std::make_unique(1, nullptr); int points = iRule->getRequiredNumberOfIntegrationPoints(_Square, order + 0); diff --git a/src/oofemlib/fei2dquadconst.h b/src/oofemlib/fei2dquadconst.h index 8bd76f2d5..0967b0c7c 100644 --- a/src/oofemlib/fei2dquadconst.h +++ b/src/oofemlib/fei2dquadconst.h @@ -46,11 +46,11 @@ class OOFEM_EXPORT FEI2dQuadConst : public FEInterpolation2d public: FEI2dQuadConst(int ind1, int ind2) : FEInterpolation2d(0, ind1, ind2) { } - integrationDomain giveIntegrationDomain() const override { return _Square; } - Element_Geometry_Type giveGeometryType() const override { return EGT_quad_1; } - integrationDomain giveBoundaryIntegrationDomain(int ib) const override { return _Line; } - integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf) const override { return _Square; } - integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge) const override { return _Line; } + integrationDomain giveIntegrationDomain(const Element_Geometry_Type) const override { return _Square; } + const Element_Geometry_Type giveGeometryType() const override { return EGT_quad_1; } + integrationDomain giveBoundaryIntegrationDomain(int ib, const Element_Geometry_Type) const override { return _Line; } + integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf, const Element_Geometry_Type) const override { return _Square; } + integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge, const Element_Geometry_Type) const override { return _Line; } // Bulk void evalN(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; @@ -66,9 +66,9 @@ class OOFEM_EXPORT FEI2dQuadConst : public FEInterpolation2d void edgeEvaldNds(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; void edgeLocal2global(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; - std::unique_ptr giveIntegrationRule(int order) const override; + std::unique_ptr giveIntegrationRule(int order, const Element_Geometry_Type) const override; - int giveNumberOfNodes() const override { return 4; } + int giveNumberOfNodes(const Element_Geometry_Type) const override { return 4; } void giveCellDofMans(IntArray& nodes, IntArray &internalDofMans, Element* elem) const override {nodes={}; internalDofMans={1};} diff --git a/src/oofemlib/fei2dquadlin.C b/src/oofemlib/fei2dquadlin.C index b8ec51189..bb787794c 100644 --- a/src/oofemlib/fei2dquadlin.C +++ b/src/oofemlib/fei2dquadlin.C @@ -311,7 +311,7 @@ FEI2dQuadLin :: computeLocalEdgeMapping(int iedge) const return {4, 1}; } else { throw std::range_error("invalid edge number"); - return {}; + //return {}; } } @@ -383,7 +383,7 @@ double FEI2dQuadLin :: evalNXIntegral(int iEdge, const FEICellGeometry &cellgeo) } std::unique_ptr -FEI2dQuadLin :: giveIntegrationRule(int order) const +FEI2dQuadLin :: giveIntegrationRule(int order, Element_Geometry_Type egt) const { auto iRule = std::make_unique(1, nullptr); int points = iRule->getRequiredNumberOfIntegrationPoints(_Square, order + 2); diff --git a/src/oofemlib/fei2dquadlin.h b/src/oofemlib/fei2dquadlin.h index efd1673f6..6144004ed 100644 --- a/src/oofemlib/fei2dquadlin.h +++ b/src/oofemlib/fei2dquadlin.h @@ -47,11 +47,11 @@ class OOFEM_EXPORT FEI2dQuadLin : public FEInterpolation2d public: FEI2dQuadLin(int ind1, int ind2) : FEInterpolation2d(1, ind1, ind2) { } - integrationDomain giveIntegrationDomain() const override { return _Square; } - Element_Geometry_Type giveGeometryType() const override { return EGT_quad_1; } - integrationDomain giveBoundaryIntegrationDomain(int ib) const override { return _Line; } - integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf) const override { return _Square; } - integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge) const override { return _Line; } + integrationDomain giveIntegrationDomain(const Element_Geometry_Type) const override { return _Square; } + const Element_Geometry_Type giveGeometryType() const override { return EGT_quad_1; } + integrationDomain giveBoundaryIntegrationDomain(int ib, const Element_Geometry_Type) const override { return _Line; } + integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf, const Element_Geometry_Type) const override { return _Square; } + integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge, const Element_Geometry_Type) const override { return _Line; } double giveArea(const FEICellGeometry &cellgeo) const override; @@ -65,7 +65,7 @@ class OOFEM_EXPORT FEI2dQuadLin : public FEInterpolation2d double evaldNdx(FloatMatrix &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; void local2global(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; int global2local(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; - int giveNumberOfNodes() const override { return 4; } + int giveNumberOfNodes(const Element_Geometry_Type) const override { return 4; } void giveCellDofMans(IntArray& nodes, IntArray& internalDofMans, Element* elem) const override {nodes={1,2,3,4};internalDofMans={};} @@ -73,14 +73,14 @@ class OOFEM_EXPORT FEI2dQuadLin : public FEInterpolation2d // Edge IntArray computeLocalEdgeMapping(int iedge) const override; - int giveNumberOfEdges() const override { return 4; } + int giveNumberOfEdges(const Element_Geometry_Type) const override { return 4; } void edgeEvalN(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; double edgeEvalNormal(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; void edgeEvaldNds(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; void edgeLocal2global(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; double evalNXIntegral(int iEdge, const FEICellGeometry &cellgeo) const override; - std::unique_ptr giveIntegrationRule(int order) const override; + std::unique_ptr giveIntegrationRule(int order, const Element_Geometry_Type) const override; protected: double edgeComputeLength(const IntArray &edgeNodes, const FEICellGeometry &cellgeo) const; diff --git a/src/oofemlib/fei2dquadquad.C b/src/oofemlib/fei2dquadquad.C index 74c28a85b..0f66858f8 100644 --- a/src/oofemlib/fei2dquadquad.C +++ b/src/oofemlib/fei2dquadquad.C @@ -314,7 +314,7 @@ FEI2dQuadQuad :: computeLocalEdgeMapping(int iedge) const return {4, 1, 8}; } else { throw std::range_error("invalid edge number"); - return {}; + //return {}; } } @@ -362,7 +362,7 @@ FEI2dQuadQuad :: evalNXIntegral(int iEdge, const FEICellGeometry &cellgeo) const std::unique_ptr -FEI2dQuadQuad :: giveIntegrationRule(int order) const +FEI2dQuadQuad :: giveIntegrationRule(int order, Element_Geometry_Type egt) const { auto iRule = std::make_unique(1, nullptr); int points = iRule->getRequiredNumberOfIntegrationPoints(_Square, order + 4); diff --git a/src/oofemlib/fei2dquadquad.h b/src/oofemlib/fei2dquadquad.h index 2b071cdb3..9950bb1c6 100644 --- a/src/oofemlib/fei2dquadquad.h +++ b/src/oofemlib/fei2dquadquad.h @@ -54,11 +54,11 @@ class OOFEM_EXPORT FEI2dQuadQuad : public FEInterpolation2d public: FEI2dQuadQuad(int ind1, int ind2) : FEInterpolation2d(2, ind1, ind2) { } - integrationDomain giveIntegrationDomain() const override { return _Square; } - Element_Geometry_Type giveGeometryType() const override { return EGT_quad_2; } - integrationDomain giveBoundaryIntegrationDomain(int ib) const override { return _Line; } - integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf) const override { return _Square; } - integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge) const override { return _Line; } + integrationDomain giveIntegrationDomain(const Element_Geometry_Type) const override { return _Square; } + const Element_Geometry_Type giveGeometryType() const override { return EGT_quad_2; } + integrationDomain giveBoundaryIntegrationDomain(int ib, const Element_Geometry_Type) const override { return _Line; } + integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf, const Element_Geometry_Type) const override { return _Square; } + integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge, const Element_Geometry_Type) const override { return _Line; } double giveArea(const FEICellGeometry &cellgeo) const override; @@ -71,7 +71,7 @@ class OOFEM_EXPORT FEI2dQuadQuad : public FEInterpolation2d double evaldNdx(FloatMatrix &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; void evaldNdxi(FloatMatrix &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; void local2global(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; - int giveNumberOfNodes() const override { return 8; } + int giveNumberOfNodes(const Element_Geometry_Type) const override { return 8; } double giveCharacteristicLength(const FEICellGeometry &cellgeo) const override; @@ -85,7 +85,7 @@ class OOFEM_EXPORT FEI2dQuadQuad : public FEInterpolation2d double edgeEvalNormal(FloatArray &normal, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; double evalNXIntegral(int iEdge, const FEICellGeometry &cellgeo) const override; - std::unique_ptr giveIntegrationRule(int order) const override; + std::unique_ptr giveIntegrationRule(int order, const Element_Geometry_Type) const override; }; diff --git a/src/oofemlib/fei2dtrconst.C b/src/oofemlib/fei2dtrconst.C index 93ab32392..3f87694fd 100644 --- a/src/oofemlib/fei2dtrconst.C +++ b/src/oofemlib/fei2dtrconst.C @@ -61,12 +61,12 @@ FEI2dTrConst :: local2global(FloatArray &answer, const FloatArray &lcoords, cons double l3 = 1.0 - l1 - l2; answer.resize(2); - answer.at(1) = ( l1 * cellgeo.giveVertexCoordinates(1)->at(xind) + - l2 * cellgeo.giveVertexCoordinates(2)->at(xind) + - l3 * cellgeo.giveVertexCoordinates(3)->at(xind) ); - answer.at(2) = ( l1 * cellgeo.giveVertexCoordinates(1)->at(yind) + - l2 * cellgeo.giveVertexCoordinates(2)->at(yind) + - l3 * cellgeo.giveVertexCoordinates(3)->at(yind) ); + answer.at(1) = ( l1 * cellgeo.giveVertexCoordinates(1).at(xind) + + l2 * cellgeo.giveVertexCoordinates(2).at(xind) + + l3 * cellgeo.giveVertexCoordinates(3).at(xind) ); + answer.at(2) = ( l1 * cellgeo.giveVertexCoordinates(1).at(yind) + + l2 * cellgeo.giveVertexCoordinates(2).at(yind) + + l3 * cellgeo.giveVertexCoordinates(3).at(yind) ); } #define POINT_TOL 1.e-3 @@ -74,13 +74,13 @@ FEI2dTrConst :: local2global(FloatArray &answer, const FloatArray &lcoords, cons int FEI2dTrConst :: global2local(FloatArray &answer, const FloatArray &coords, const FEICellGeometry &cellgeo) const { - double x1 = cellgeo.giveVertexCoordinates(1)->at(xind); - double x2 = cellgeo.giveVertexCoordinates(2)->at(xind); - double x3 = cellgeo.giveVertexCoordinates(3)->at(xind); + double x1 = cellgeo.giveVertexCoordinates(1).at(xind); + double x2 = cellgeo.giveVertexCoordinates(2).at(xind); + double x3 = cellgeo.giveVertexCoordinates(3).at(xind); - double y1 = cellgeo.giveVertexCoordinates(1)->at(yind); - double y2 = cellgeo.giveVertexCoordinates(2)->at(yind); - double y3 = cellgeo.giveVertexCoordinates(3)->at(yind); + double y1 = cellgeo.giveVertexCoordinates(1).at(yind); + double y2 = cellgeo.giveVertexCoordinates(2).at(yind); + double y3 = cellgeo.giveVertexCoordinates(3).at(yind); double detJ = ( x2 * y3 + x1 * y2 + y1 * x3 - x2 * y1 - x3 * y2 - x1 * y3 ); @@ -109,13 +109,13 @@ FEI2dTrConst :: global2local(FloatArray &answer, const FloatArray &coords, const double FEI2dTrConst :: giveTransformationJacobian(const FloatArray &lcoords, const FEICellGeometry &cellgeo) const { - double x1 = cellgeo.giveVertexCoordinates(1)->at(xind); - double x2 = cellgeo.giveVertexCoordinates(2)->at(xind); - double x3 = cellgeo.giveVertexCoordinates(3)->at(xind); + double x1 = cellgeo.giveVertexCoordinates(1).at(xind); + double x2 = cellgeo.giveVertexCoordinates(2).at(xind); + double x3 = cellgeo.giveVertexCoordinates(3).at(xind); - double y1 = cellgeo.giveVertexCoordinates(1)->at(yind); - double y2 = cellgeo.giveVertexCoordinates(2)->at(yind); - double y3 = cellgeo.giveVertexCoordinates(3)->at(yind); + double y1 = cellgeo.giveVertexCoordinates(1).at(yind); + double y2 = cellgeo.giveVertexCoordinates(2).at(yind); + double y3 = cellgeo.giveVertexCoordinates(3).at(yind); return x1 * ( y2 - y3 ) + x2 * ( -y1 + y3 ) + x3 * ( y1 - y2 ); } @@ -150,10 +150,10 @@ FEI2dTrConst :: edgeLocal2global(FloatArray &answer, int iedge, const auto &edgeNodes = this->computeLocalEdgeMapping(iedge); answer.resize(2); - answer.at(1) = ( n.at(1) * cellgeo.giveVertexCoordinates( edgeNodes.at(1) )->at(xind) + - n.at(2) * cellgeo.giveVertexCoordinates( edgeNodes.at(2) )->at(xind) ); - answer.at(2) = ( n.at(1) * cellgeo.giveVertexCoordinates( edgeNodes.at(1) )->at(yind) + - n.at(2) * cellgeo.giveVertexCoordinates( edgeNodes.at(2) )->at(yind) ); + answer.at(1) = ( n.at(1) * cellgeo.giveVertexCoordinates( edgeNodes.at(1) ).at(xind) + + n.at(2) * cellgeo.giveVertexCoordinates( edgeNodes.at(2) ).at(xind) ); + answer.at(2) = ( n.at(1) * cellgeo.giveVertexCoordinates( edgeNodes.at(1) ).at(yind) + + n.at(2) * cellgeo.giveVertexCoordinates( edgeNodes.at(2) ).at(yind) ); } IntArray @@ -172,18 +172,18 @@ FEI2dTrConst :: computeLocalEdgeMapping(int iedge) const } double -FEI2dTrConst :: edgeComputeLength(IntArray &edgeNodes, const FEICellGeometry &cellgeo) const +FEI2dTrConst :: edgeComputeLength(const IntArray &edgeNodes, const FEICellGeometry &cellgeo) const { auto nodeA = edgeNodes.at(1); auto nodeB = edgeNodes.at(2); - double dx = cellgeo.giveVertexCoordinates(nodeB)->at(xind) - cellgeo.giveVertexCoordinates(nodeA)->at(xind); - double dy = cellgeo.giveVertexCoordinates(nodeB)->at(yind) - cellgeo.giveVertexCoordinates(nodeA)->at(yind); + double dx = cellgeo.giveVertexCoordinates(nodeB).at(xind) - cellgeo.giveVertexCoordinates(nodeA).at(xind); + double dy = cellgeo.giveVertexCoordinates(nodeB).at(yind) - cellgeo.giveVertexCoordinates(nodeA).at(yind); return sqrt(dx * dx + dy * dy); } std::unique_ptr -FEI2dTrConst :: giveIntegrationRule(int order) const +FEI2dTrConst :: giveIntegrationRule(int order, Element_Geometry_Type egt) const { auto iRule = std::make_unique(1, nullptr); int points = iRule->getRequiredNumberOfIntegrationPoints(_Triangle, order + 0); diff --git a/src/oofemlib/fei2dtrconst.h b/src/oofemlib/fei2dtrconst.h index 81c3be926..11d4b5f0f 100644 --- a/src/oofemlib/fei2dtrconst.h +++ b/src/oofemlib/fei2dtrconst.h @@ -46,8 +46,8 @@ class OOFEM_EXPORT FEI2dTrConst : public FEInterpolation2d public: FEI2dTrConst(int ind1, int ind2) : FEInterpolation2d(0, ind1, ind2) { } - integrationDomain giveIntegrationDomain() const override { return _Triangle; } - Element_Geometry_Type giveGeometryType() const override { return EGT_triangle_1; } + integrationDomain giveIntegrationDomain(const Element_Geometry_Type) const override { return _Triangle; } + const Element_Geometry_Type giveGeometryType() const override { return EGT_triangle_1; } // Bulk void evalN(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; @@ -63,9 +63,9 @@ class OOFEM_EXPORT FEI2dTrConst : public FEInterpolation2d void edgeEvaldNds(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; void edgeLocal2global(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; - std::unique_ptr giveIntegrationRule(int order) const override; + std::unique_ptr giveIntegrationRule(int order, const Element_Geometry_Type) const override; - int giveNumberOfNodes() const override { return 3; } + int giveNumberOfNodes(const Element_Geometry_Type) const override { return 3; } protected: double edgeComputeLength(const IntArray &edgeNodes, const FEICellGeometry &cellgeo) const; diff --git a/src/oofemlib/fei2dtrlin.C b/src/oofemlib/fei2dtrlin.C index 3526bfec6..613c10a7c 100644 --- a/src/oofemlib/fei2dtrlin.C +++ b/src/oofemlib/fei2dtrlin.C @@ -257,7 +257,7 @@ FEI2dTrLin :: computeLocalEdgeMapping(int iedge) const return {3, 1}; } else { throw std::range_error("invalid edge number"); - return {}; + //return {}; } } @@ -305,7 +305,7 @@ FEI2dTrLin :: evalNXIntegral(int iEdge, const FEICellGeometry &cellgeo) const } std::unique_ptr -FEI2dTrLin :: giveIntegrationRule(int order) const +FEI2dTrLin :: giveIntegrationRule(int order, Element_Geometry_Type egt) const { auto iRule = std::make_unique(1, nullptr); int points = iRule->getRequiredNumberOfIntegrationPoints(_Triangle, order + 0); diff --git a/src/oofemlib/fei2dtrlin.h b/src/oofemlib/fei2dtrlin.h index 3d37f71e8..96f73e186 100644 --- a/src/oofemlib/fei2dtrlin.h +++ b/src/oofemlib/fei2dtrlin.h @@ -46,12 +46,12 @@ class OOFEM_EXPORT FEI2dTrLin : public FEInterpolation2d public: FEI2dTrLin(int ind1, int ind2) : FEInterpolation2d(1, ind1, ind2) { } - integrationDomain giveIntegrationDomain() const override { return _Triangle; } - integrationDomain giveBoundaryIntegrationDomain(int ib) const override { return _Line; } - integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf) const override { return _Triangle; } - integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge) const override { return _Line; } + integrationDomain giveIntegrationDomain(const Element_Geometry_Type) const override { return _Triangle; } + integrationDomain giveBoundaryIntegrationDomain(int ib, const Element_Geometry_Type) const override { return _Line; } + integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf, const Element_Geometry_Type) const override { return _Triangle; } + integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge, const Element_Geometry_Type) const override { return _Line; } - Element_Geometry_Type giveGeometryType() const override { return EGT_triangle_1; } + const Element_Geometry_Type giveGeometryType() const override { return EGT_triangle_1; } // Bulk static FloatArrayF<3> evalN(const FloatArrayF<2> &lcoords) ; @@ -63,20 +63,20 @@ class OOFEM_EXPORT FEI2dTrLin : public FEInterpolation2d int global2local(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; double giveTransformationJacobian(const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; double giveArea(const FEICellGeometry &cellgeo) const override; - int giveNumberOfNodes() const override { return 3; } + int giveNumberOfNodes(const Element_Geometry_Type) const override { return 3; } bool inside(const FloatArray &lcoords) const override; // Edge IntArray computeLocalEdgeMapping(int iedge) const override; - int giveNumberOfEdges() const override { return 3; } + int giveNumberOfEdges(const Element_Geometry_Type) const override { return 3; } void edgeEvalN(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; double edgeEvalNormal(FloatArray &normal, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; void edgeEvaldNds(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; void edgeLocal2global(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; double evalNXIntegral(int iEdge, const FEICellGeometry &cellgeo) const override; - std::unique_ptr giveIntegrationRule(int order) const override; + std::unique_ptr giveIntegrationRule(int order, const Element_Geometry_Type) const override; protected: double edgeComputeLength(const IntArray &edgeNodes, const FEICellGeometry &cellgeo) const; diff --git a/src/oofemlib/fei2dtrquad.C b/src/oofemlib/fei2dtrquad.C index 3eb6ebe8f..56eb43fad 100644 --- a/src/oofemlib/fei2dtrquad.C +++ b/src/oofemlib/fei2dtrquad.C @@ -312,7 +312,7 @@ FEI2dTrQuad :: computeLocalEdgeMapping(int iedge) const return {3, 1, 6}; } else { throw std::range_error("invalid edge number"); - return {}; + //return {}; } } @@ -410,7 +410,7 @@ FEI2dTrQuad :: evalNXIntegral(int iEdge, const FEICellGeometry &cellgeo) const } std::unique_ptr -FEI2dTrQuad :: giveIntegrationRule(int order) const +FEI2dTrQuad :: giveIntegrationRule(int order, Element_Geometry_Type egt) const { auto iRule = std::make_unique(1, nullptr); int points = iRule->getRequiredNumberOfIntegrationPoints(_Triangle, order + 2); diff --git a/src/oofemlib/fei2dtrquad.h b/src/oofemlib/fei2dtrquad.h index 6eb4775d5..105a88e48 100644 --- a/src/oofemlib/fei2dtrquad.h +++ b/src/oofemlib/fei2dtrquad.h @@ -46,11 +46,11 @@ class OOFEM_EXPORT FEI2dTrQuad : public FEInterpolation2d public: FEI2dTrQuad(int ind1, int ind2) : FEInterpolation2d(2, ind1, ind2) { } - integrationDomain giveIntegrationDomain() const override { return _Triangle; } - Element_Geometry_Type giveGeometryType() const override { return EGT_triangle_2; } - integrationDomain giveBoundaryIntegrationDomain(int ib) const override { return _Line; } - integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf) const override { return _Triangle; } - integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge) const override { return _Line; } + integrationDomain giveIntegrationDomain(const Element_Geometry_Type) const override { return _Triangle; } + const Element_Geometry_Type giveGeometryType() const override { return EGT_triangle_2; } + integrationDomain giveBoundaryIntegrationDomain(int ib, const Element_Geometry_Type) const override { return _Line; } + integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf, const Element_Geometry_Type) const override { return _Triangle; } + integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge, const Element_Geometry_Type) const override { return _Line; } // Bulk static FloatArrayF<6> evalN(const FloatArrayF<2> &lcoords); @@ -62,20 +62,20 @@ class OOFEM_EXPORT FEI2dTrQuad : public FEInterpolation2d void evald2Ndx2(FloatMatrix &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; void local2global(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; double giveArea(const FEICellGeometry &cellgeo) const override; - int giveNumberOfNodes() const override { return 6; } + int giveNumberOfNodes(const Element_Geometry_Type) const override { return 6; } bool inside(const FloatArray &lcoords) const override; // Edge IntArray computeLocalEdgeMapping(int iedge) const override; - int giveNumberOfEdges() const override { return 3; } + int giveNumberOfEdges(const Element_Geometry_Type) const override { return 3; } void edgeEvalN(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; double edgeEvalNormal(FloatArray &normal, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; void edgeEvaldNds(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; void edgeLocal2global(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; double evalNXIntegral(int iEdge, const FEICellGeometry &cellgeo) const override; - std::unique_ptr giveIntegrationRule(int order) const override; + std::unique_ptr giveIntegrationRule(int order, const Element_Geometry_Type) const override; void evaldNdxi(FloatMatrix &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; diff --git a/src/oofemlib/fei3dhexaconst.C b/src/oofemlib/fei3dhexaconst.C index 1ed93fe2d..a887fa6b0 100644 --- a/src/oofemlib/fei3dhexaconst.C +++ b/src/oofemlib/fei3dhexaconst.C @@ -270,7 +270,7 @@ FEI3dHexaConst :: computeLocalEdgeMapping(int iedge) const return {8, 5}; } else { throw std::range_error("invalid edge number"); - return {}; + //return {}; } } @@ -334,7 +334,7 @@ FEI3dHexaConst :: computeLocalSurfaceMapping(int isurf) const } std::unique_ptr -FEI3dHexaConst :: giveIntegrationRule(int order) const +FEI3dHexaConst :: giveIntegrationRule(int order, Element_Geometry_Type egt) const { auto iRule = std::make_unique(1, nullptr); int points = iRule->getRequiredNumberOfIntegrationPoints(_Cube, order + 0); @@ -343,7 +343,7 @@ FEI3dHexaConst :: giveIntegrationRule(int order) const } std::unique_ptr -FEI3dHexaConst :: giveBoundaryIntegrationRule(int order, int boundary) const +FEI3dHexaConst :: giveBoundaryIntegrationRule(int order, int boundary, Element_Geometry_Type egt) const { auto iRule = std::make_unique(1, nullptr); int points = iRule->getRequiredNumberOfIntegrationPoints(_Square, order + 0); diff --git a/src/oofemlib/fei3dhexaconst.h b/src/oofemlib/fei3dhexaconst.h index 73e7f2cf0..ce77602ea 100644 --- a/src/oofemlib/fei3dhexaconst.h +++ b/src/oofemlib/fei3dhexaconst.h @@ -47,18 +47,18 @@ class OOFEM_EXPORT FEI3dHexaConst : public FEInterpolation3d public: FEI3dHexaConst() : FEInterpolation3d(1) { } - integrationDomain giveIntegrationDomain() const override { return _Cube; } - Element_Geometry_Type giveGeometryType() const override { return EGT_hexa_1; } - integrationDomain giveBoundaryIntegrationDomain(int ib) const override { return _Square; } - integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf) const override { return _Square; } - integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge) const override { return _Line; } + integrationDomain giveIntegrationDomain(const Element_Geometry_Type) const override { return _Cube; } + const Element_Geometry_Type giveGeometryType() const override { return EGT_hexa_1; } + integrationDomain giveBoundaryIntegrationDomain(int ib, const Element_Geometry_Type) const override { return _Square; } + integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf, const Element_Geometry_Type) const override { return _Square; } + integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge, const Element_Geometry_Type) const override { return _Line; } // Bulk void evalN(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; double evaldNdx(FloatMatrix &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; void local2global(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; int global2local(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; - int giveNumberOfNodes() const override { return 8; } + int giveNumberOfNodes(const Element_Geometry_Type) const override { return 8; } void giveCellDofMans(IntArray& nodes, IntArray& internalDofMans, Element* elem) const override {nodes={}; internalDofMans={1};} @@ -78,8 +78,8 @@ class OOFEM_EXPORT FEI3dHexaConst : public FEInterpolation3d double surfaceGiveTransformationJacobian(int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; IntArray computeLocalSurfaceMapping(int iedge) const override; - std::unique_ptr giveIntegrationRule(int order) const override; - std::unique_ptr giveBoundaryIntegrationRule(int order, int boundary) const override; + std::unique_ptr giveIntegrationRule(int order, const Element_Geometry_Type) const override; + std::unique_ptr giveBoundaryIntegrationRule(int order, int boundary, const Element_Geometry_Type) const override; protected: double edgeComputeLength(const IntArray &edgeNodes, const FEICellGeometry &cellgeo) const; diff --git a/src/oofemlib/fei3dhexalin.C b/src/oofemlib/fei3dhexalin.C index 4030fe263..f8ae0064f 100644 --- a/src/oofemlib/fei3dhexalin.C +++ b/src/oofemlib/fei3dhexalin.C @@ -433,7 +433,7 @@ FEI3dHexaLin :: computeLocalEdgeMapping(int iedge) const return {8, 5}; } else { throw std::range_error("invalid edge number"); - return {}; + //return {}; } } @@ -617,7 +617,7 @@ FEI3dHexaLin :: evalNXIntegral(int iEdge, const FEICellGeometry &cellgeo) const } std::unique_ptr -FEI3dHexaLin :: giveIntegrationRule(int order) const +FEI3dHexaLin :: giveIntegrationRule(int order, Element_Geometry_Type egt) const { auto iRule = std::make_unique(1, nullptr); int points = iRule->getRequiredNumberOfIntegrationPoints(_Cube, order + 6); @@ -626,7 +626,7 @@ FEI3dHexaLin :: giveIntegrationRule(int order) const } std::unique_ptr -FEI3dHexaLin :: giveBoundaryIntegrationRule(int order, int boundary) const +FEI3dHexaLin :: giveBoundaryIntegrationRule(int order, int boundary, Element_Geometry_Type egt) const { auto iRule = std::make_unique(1, nullptr); int points = iRule->getRequiredNumberOfIntegrationPoints(_Square, order + 2); diff --git a/src/oofemlib/fei3dhexalin.h b/src/oofemlib/fei3dhexalin.h index 029d7630e..77d043b24 100644 --- a/src/oofemlib/fei3dhexalin.h +++ b/src/oofemlib/fei3dhexalin.h @@ -47,11 +47,11 @@ class OOFEM_EXPORT FEI3dHexaLin : public FEInterpolation3d public: FEI3dHexaLin() : FEInterpolation3d(1) { } - integrationDomain giveIntegrationDomain() const override { return _Cube; } - Element_Geometry_Type giveGeometryType() const override { return EGT_hexa_1; } - integrationDomain giveBoundaryIntegrationDomain(int ib) const override { return _Square; } - integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf) const override { return _Square; } - integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge) const override { return _Line; } + integrationDomain giveIntegrationDomain(const Element_Geometry_Type) const override { return _Cube; } + const Element_Geometry_Type giveGeometryType() const override { return EGT_hexa_1; } + integrationDomain giveBoundaryIntegrationDomain(int ib, const Element_Geometry_Type) const override { return _Square; } + integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf, const Element_Geometry_Type) const override { return _Square; } + integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge, const Element_Geometry_Type) const override { return _Line; } // Bulk static FloatArrayF<8> evalN(const FloatArrayF<3> &lcoords); @@ -63,7 +63,7 @@ class OOFEM_EXPORT FEI3dHexaLin : public FEInterpolation3d void evaldNdxi(FloatMatrix &dN, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; void local2global(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; int global2local(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; - int giveNumberOfNodes() const override { return 8; } + int giveNumberOfNodes(const Element_Geometry_Type) const override { return 8; } void giveCellDofMans(IntArray& nodes, IntArray& internalDofMans, Element* elem) const override {nodes={1,2,3,4,5,6,7,8}; internalDofMans={};} @@ -86,8 +86,8 @@ class OOFEM_EXPORT FEI3dHexaLin : public FEInterpolation3d void giveJacobianMatrixAt(FloatMatrix &jacobianMatrix, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; double evalNXIntegral(int iEdge, const FEICellGeometry &cellgeo) const override; - std::unique_ptr giveIntegrationRule(int order) const override; - std::unique_ptr giveBoundaryIntegrationRule(int order, int boundary) const override; + std::unique_ptr giveIntegrationRule(int order, const Element_Geometry_Type) const override; + std::unique_ptr giveBoundaryIntegrationRule(int order, int boundary, const Element_Geometry_Type) const override; protected: double edgeComputeLength(const IntArray &edgeNodes, const FEICellGeometry &cellgeo) const; diff --git a/src/oofemlib/fei3dhexaquad.C b/src/oofemlib/fei3dhexaquad.C index af84f8814..e56b360f9 100644 --- a/src/oofemlib/fei3dhexaquad.C +++ b/src/oofemlib/fei3dhexaquad.C @@ -766,7 +766,7 @@ FEI3dHexaQuad :: evalNXIntegral(int iEdge, const FEICellGeometry &cellgeo) const std::unique_ptr -FEI3dHexaQuad :: giveIntegrationRule(int order) const +FEI3dHexaQuad :: giveIntegrationRule(int order, Element_Geometry_Type egt) const { auto iRule = std::make_unique(1, nullptr); int points = iRule->getRequiredNumberOfIntegrationPoints(_Cube, order + 9); @@ -775,7 +775,7 @@ FEI3dHexaQuad :: giveIntegrationRule(int order) const } std::unique_ptr -FEI3dHexaQuad :: giveBoundaryIntegrationRule(int order, int boundary) const +FEI3dHexaQuad :: giveBoundaryIntegrationRule(int order, int boundary, Element_Geometry_Type egt) const { auto iRule = std::make_unique(1, nullptr); int points = iRule->getRequiredNumberOfIntegrationPoints(_Square, order + 4); diff --git a/src/oofemlib/fei3dhexaquad.h b/src/oofemlib/fei3dhexaquad.h index 38c9cac84..bd1bf04cb 100644 --- a/src/oofemlib/fei3dhexaquad.h +++ b/src/oofemlib/fei3dhexaquad.h @@ -72,11 +72,11 @@ class OOFEM_EXPORT FEI3dHexaQuad : public FEInterpolation3d public: FEI3dHexaQuad() : FEInterpolation3d(2) { } - integrationDomain giveIntegrationDomain() const override { return _Cube; } - Element_Geometry_Type giveGeometryType() const override { return EGT_hexa_2; } - integrationDomain giveBoundaryIntegrationDomain(int ib) const override { return _Square; } - integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf) const override { return _Square; } - integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge) const override { return _Line; } + integrationDomain giveIntegrationDomain(const Element_Geometry_Type) const override { return _Cube; } + const Element_Geometry_Type giveGeometryType() const override { return EGT_hexa_2; } + integrationDomain giveBoundaryIntegrationDomain(int ib, const Element_Geometry_Type) const override { return _Square; } + integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf, const Element_Geometry_Type) const override { return _Square; } + integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge, const Element_Geometry_Type) const override { return _Line; } double giveCharacteristicLength(const FEICellGeometry &cellgeo) const; @@ -90,7 +90,7 @@ class OOFEM_EXPORT FEI3dHexaQuad : public FEInterpolation3d void evaldNdxi(FloatMatrix &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; void local2global(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; int global2local(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; - int giveNumberOfNodes() const override { return 20; } + int giveNumberOfNodes(const Element_Geometry_Type) const override { return 20; } // Edge void edgeEvalN(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; @@ -110,8 +110,8 @@ class OOFEM_EXPORT FEI3dHexaQuad : public FEInterpolation3d void giveJacobianMatrixAt(FloatMatrix &jacobianMatrix, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; - std::unique_ptr giveIntegrationRule(int order) const override; - std::unique_ptr giveBoundaryIntegrationRule(int order, int boundary) const override; + std::unique_ptr giveIntegrationRule(int order, const Element_Geometry_Type) const override; + std::unique_ptr giveBoundaryIntegrationRule(int order, int boundary, const Element_Geometry_Type) const override; }; } // end namespace oofem #endif diff --git a/src/oofemlib/fei3dhexatriquad.C b/src/oofemlib/fei3dhexatriquad.C index 916b0a408..5e223978f 100644 --- a/src/oofemlib/fei3dhexatriquad.C +++ b/src/oofemlib/fei3dhexatriquad.C @@ -582,7 +582,7 @@ FEI3dHexaTriQuad :: evalNXIntegral(int iSurf, const FEICellGeometry &cellgeo) co } std::unique_ptr -FEI3dHexaTriQuad :: giveIntegrationRule(int order) const +FEI3dHexaTriQuad :: giveIntegrationRule(int order, Element_Geometry_Type egt) const { auto iRule = std::make_unique(1, nullptr); ///@todo Verify: Is +15 correct for dealing with "detJ"? If it is, perhaps we shouldn't go for exact integration since it is likely overkill. @@ -592,7 +592,7 @@ FEI3dHexaTriQuad :: giveIntegrationRule(int order) const } std::unique_ptr -FEI3dHexaTriQuad :: giveBoundaryIntegrationRule(int order, int boundary) const +FEI3dHexaTriQuad :: giveBoundaryIntegrationRule(int order, int boundary, Element_Geometry_Type egt) const { auto iRule = std::make_unique(1, nullptr); ///@todo Verify: Is +6 correct for dealing with "detJ" on this surface? diff --git a/src/oofemlib/fei3dhexatriquad.h b/src/oofemlib/fei3dhexatriquad.h index f428f6349..b14c17333 100644 --- a/src/oofemlib/fei3dhexatriquad.h +++ b/src/oofemlib/fei3dhexatriquad.h @@ -47,11 +47,11 @@ class OOFEM_EXPORT FEI3dHexaTriQuad : public FEI3dHexaQuad public: FEI3dHexaTriQuad() : FEI3dHexaQuad() { } - integrationDomain giveIntegrationDomain() const override { return _Cube; } - Element_Geometry_Type giveGeometryType() const override { return EGT_hexa_27; } - integrationDomain giveBoundaryIntegrationDomain(int ib) const override { return _Square; } - integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf) const override { return _Square; } - integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge) const override { return _Line; } + integrationDomain giveIntegrationDomain(const Element_Geometry_Type) const override { return _Cube; } + const Element_Geometry_Type giveGeometryType() const override { return EGT_hexa_27; } + integrationDomain giveBoundaryIntegrationDomain(int ib, const Element_Geometry_Type) const override { return _Square; } + integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf, const Element_Geometry_Type) const override { return _Square; } + integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge, const Element_Geometry_Type) const override { return _Line; } // Bulk static FloatArrayF<27> evalN(const FloatArrayF<3> &lcoords); @@ -61,7 +61,7 @@ class OOFEM_EXPORT FEI3dHexaTriQuad : public FEI3dHexaQuad void evalN(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; double evaldNdx(FloatMatrix &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; void evaldNdxi(FloatMatrix &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; - int giveNumberOfNodes() const override { return 27; } + int giveNumberOfNodes(const Element_Geometry_Type) const override { return 27; } // Surface void surfaceEvalN(FloatArray &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; @@ -70,8 +70,8 @@ class OOFEM_EXPORT FEI3dHexaTriQuad : public FEI3dHexaQuad IntArray computeLocalSurfaceMapping(int iSurf) const override; double evalNXIntegral(int iSurf, const FEICellGeometry &cellgeo) const override; - std::unique_ptr giveIntegrationRule(int order) const override; - std::unique_ptr giveBoundaryIntegrationRule(int order, int boundary) const override; + std::unique_ptr giveIntegrationRule(int order, const Element_Geometry_Type) const override; + std::unique_ptr giveBoundaryIntegrationRule(int order, int boundary, const Element_Geometry_Type) const override; }; } // end namespace oofem #endif diff --git a/src/oofemlib/fei3dlinelin.C b/src/oofemlib/fei3dlinelin.C index 98e854ce2..a73e7ae3c 100644 --- a/src/oofemlib/fei3dlinelin.C +++ b/src/oofemlib/fei3dlinelin.C @@ -166,7 +166,7 @@ double FEI3dLineLin :: surfaceEvalNormal(FloatArray &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const { OOFEM_ERROR("no surfaces available"); - return 0.0; + //return 0.0; } void @@ -181,14 +181,14 @@ FEI3dLineLin :: surfaceGiveTransformationJacobian(int isurf, const FloatArray &l const FEICellGeometry &cellgeo) const { OOFEM_ERROR("no surfaces available"); - return 0.0; + //return 0.0; } IntArray FEI3dLineLin :: computeLocalSurfaceMapping(int isurf) const { OOFEM_ERROR("no surfaces available"); - return {}; + //return {}; } @@ -202,7 +202,7 @@ FEI3dLineLin :: giveJacobianMatrixAt(FloatMatrix &jacobianMatrix, const FloatArr } std::unique_ptr -FEI3dLineLin :: giveIntegrationRule(int order) const +FEI3dLineLin :: giveIntegrationRule(int order, Element_Geometry_Type egt) const { auto iRule = std::make_unique(1, nullptr); int points = iRule->getRequiredNumberOfIntegrationPoints(_Line, order + 0); @@ -211,10 +211,10 @@ FEI3dLineLin :: giveIntegrationRule(int order) const } std::unique_ptr -FEI3dLineLin :: giveBoundaryIntegrationRule(int order, int boundary) const +FEI3dLineLin :: giveBoundaryIntegrationRule(int order, int boundary, Element_Geometry_Type egt) const { ///@todo Not sure about this. OOFEM_ERROR("Not supported"); - return nullptr; + //return nullptr; } } // end namespace oofem diff --git a/src/oofemlib/fei3dlinelin.h b/src/oofemlib/fei3dlinelin.h index 86bb74fe5..31a8a7baa 100644 --- a/src/oofemlib/fei3dlinelin.h +++ b/src/oofemlib/fei3dlinelin.h @@ -46,11 +46,11 @@ class OOFEM_EXPORT FEI3dLineLin : public FEInterpolation3d public: FEI3dLineLin() : FEInterpolation3d(1) { } - integrationDomain giveIntegrationDomain() const override { return _Line; } - Element_Geometry_Type giveGeometryType() const override { return EGT_line_1; } - integrationDomain giveBoundaryIntegrationDomain(int ib) const override { return _Point; } - integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf) const override { return _UnknownIntegrationDomain; } - integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge) const override { return _UnknownIntegrationDomain; } + integrationDomain giveIntegrationDomain(const Element_Geometry_Type) const override { return _Line; } + const Element_Geometry_Type giveGeometryType() const override { return EGT_line_1; } + integrationDomain giveBoundaryIntegrationDomain(int ib, const Element_Geometry_Type) const override { return _Point; } + integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf, const Element_Geometry_Type) const override { return _UnknownIntegrationDomain; } + integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge, const Element_Geometry_Type) const override { return _UnknownIntegrationDomain; } double giveVolume(const FEICellGeometry &cellgeo) const override { return 0.; } double giveLength(const FEICellGeometry &cellgeo) const; @@ -76,10 +76,10 @@ class OOFEM_EXPORT FEI3dLineLin : public FEInterpolation3d void giveJacobianMatrixAt(FloatMatrix &jacobianMatrix, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; - int giveNumberOfNodes() const override { return 2; } + int giveNumberOfNodes(const Element_Geometry_Type) const override { return 2; } - std::unique_ptr giveIntegrationRule(int order) const override; - std::unique_ptr giveBoundaryIntegrationRule(int order, int boundary) const override; + std::unique_ptr giveIntegrationRule(int order, const Element_Geometry_Type) const override; + std::unique_ptr giveBoundaryIntegrationRule(int order, int boundary, const Element_Geometry_Type) const override; }; } // end namespace oofem #endif // fei3dlinelin_h diff --git a/src/oofemlib/fei3dquadlin.C b/src/oofemlib/fei3dquadlin.C index df8c05176..0c285503c 100644 --- a/src/oofemlib/fei3dquadlin.C +++ b/src/oofemlib/fei3dquadlin.C @@ -51,7 +51,7 @@ double FEI3dQuadLin :: evaldNdx(FloatMatrix &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const { OOFEM_ERROR("FEI3dQuadLin :: evaldNdx - Not supported"); - return 0.; + //return 0.; } @@ -78,7 +78,7 @@ int FEI3dQuadLin :: global2local(FloatArray &answer, const FloatArray &gcoords, const FEICellGeometry &cellgeo) const { OOFEM_ERROR("FEI3dQuadLin :: global2local - Not supported"); - return -1; + //return -1; } @@ -134,7 +134,7 @@ FEI3dQuadLin :: edgeLocal2global(FloatArray &answer, int iedge, double FEI3dQuadLin :: edgeGiveTransformationJacobian(int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const { - const auto &edgeNodes = this->computeLocalEdgeMapping(iedge); + // const auto &edgeNodes = this->computeLocalEdgeMapping(iedge); ///@todo Implement this OOFEM_ERROR("FEI3dQuadLin :: edgeGiveTransformationJacobian - Not supported"); return -1; @@ -154,7 +154,7 @@ FEI3dQuadLin :: computeLocalEdgeMapping(int iedge) const return { 4, 1 }; } else { throw std::range_error("invalid edge number"); - return {}; + // return {}; } } @@ -163,7 +163,7 @@ FEI3dQuadLin :: edgeComputeLength(const IntArray &edgeNodes, const FEICellGeomet { ///@todo Implement this OOFEM_ERROR("FEI3dQuadLin :: edgeComputeLength - Not supported"); - return -1; + //return -1; } void @@ -273,7 +273,7 @@ double FEI3dQuadLin :: surfaceGiveTransformationJacobian(int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const { OOFEM_ERROR("FEI3dQuadLin :: surfaceGiveTransformationJacobian - Not supported yet"); - return 0; + //return 0; } IntArray @@ -285,7 +285,7 @@ FEI3dQuadLin :: computeLocalSurfaceMapping(int isurf) const } std::unique_ptr -FEI3dQuadLin :: giveIntegrationRule(int order) const +FEI3dQuadLin :: giveIntegrationRule(int order, Element_Geometry_Type egt) const { auto iRule = std::make_unique(1, nullptr); int points = iRule->getRequiredNumberOfIntegrationPoints(_Square, order); @@ -294,11 +294,11 @@ FEI3dQuadLin :: giveIntegrationRule(int order) const } std::unique_ptr -FEI3dQuadLin :: giveBoundaryIntegrationRule(int order, int boundary) const +FEI3dQuadLin :: giveBoundaryIntegrationRule(int order, int boundary, Element_Geometry_Type egt) const { ///@todo Not sure about what defines boundaries on these elements. OOFEM_ERROR("FEI3dQuadLin :: giveBoundaryIntegrationRule - Not supported"); - return nullptr; + //return nullptr; } @@ -307,7 +307,7 @@ FEI3dQuadLin :: giveArea(const FEICellGeometry &cellgeo) const { ///@todo Not sure about what defines boundaries on these elements. OOFEM_ERROR("FEI3dQuadLin :: giveArea - Not supported"); - return 0.; + //return 0.; } } // end namespace oofem diff --git a/src/oofemlib/fei3dquadlin.h b/src/oofemlib/fei3dquadlin.h index 035524892..04b056e4a 100644 --- a/src/oofemlib/fei3dquadlin.h +++ b/src/oofemlib/fei3dquadlin.h @@ -47,11 +47,11 @@ class OOFEM_EXPORT FEI3dQuadLin : public FEInterpolation3d public: FEI3dQuadLin() : FEInterpolation3d(2) { } - integrationDomain giveIntegrationDomain() const override { return _Square; } - Element_Geometry_Type giveGeometryType() const override { return EGT_quad_1_interface; } - integrationDomain giveBoundaryIntegrationDomain(int ib) const override { return _Line; } - integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf) const override { return _Square; } - integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge) const override { return _Line; } + integrationDomain giveIntegrationDomain(const Element_Geometry_Type) const override { return _Square; } + const Element_Geometry_Type giveGeometryType() const override { return EGT_quad_1_interface; } + integrationDomain giveBoundaryIntegrationDomain(int ib, const Element_Geometry_Type) const override { return _Line; } + integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf, const Element_Geometry_Type) const override { return _Square; } + integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge, const Element_Geometry_Type) const override { return _Line; } // Bulk void evalN(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; @@ -69,7 +69,7 @@ class OOFEM_EXPORT FEI3dQuadLin : public FEInterpolation3d double edgeGiveTransformationJacobian(int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; IntArray computeLocalEdgeMapping(int iedge) const override; - int giveNumberOfEdges() const override { return 4; } + int giveNumberOfEdges(const Element_Geometry_Type) const override { return 4; } // Surface void surfaceEvalN(FloatArray &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; @@ -83,11 +83,11 @@ class OOFEM_EXPORT FEI3dQuadLin : public FEInterpolation3d void surfaceEvalBaseVectorsAt(FloatArray &G1, FloatArray &G2, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const ; void surfaceGiveJacobianMatrixAt(FloatMatrix &jacobianMatrix, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const ; - std::unique_ptr giveIntegrationRule(int order) const override; - std::unique_ptr giveBoundaryIntegrationRule(int order, int boundary) const override; + std::unique_ptr giveIntegrationRule(int order, const Element_Geometry_Type) const override; + std::unique_ptr giveBoundaryIntegrationRule(int order, int boundary, const Element_Geometry_Type) const override; double giveArea(const FEICellGeometry &cellgeo) const; - int giveNumberOfNodes() const override { return 4; } + int giveNumberOfNodes(const Element_Geometry_Type) const override { return 4; } protected: double edgeComputeLength(const IntArray &edgeNodes, const FEICellGeometry &cellgeo) const; diff --git a/src/oofemlib/fei3dtetlin.C b/src/oofemlib/fei3dtetlin.C index f79f8c9d3..353cfc815 100644 --- a/src/oofemlib/fei3dtetlin.C +++ b/src/oofemlib/fei3dtetlin.C @@ -348,7 +348,6 @@ FEI3dTetLin :: computeLocalEdgeMapping(int iedge) const return {3, 4}; } else { throw std::range_error("invalid edge number"); - return {}; } } @@ -475,7 +474,7 @@ FEI3dTetLin :: evalNXIntegral(int iEdge, const FEICellGeometry &cellgeo) const } std::unique_ptr -FEI3dTetLin :: giveIntegrationRule(int order) const +FEI3dTetLin :: giveIntegrationRule(int order, Element_Geometry_Type egt) const { auto iRule = std::make_unique(1, nullptr); int points = iRule->getRequiredNumberOfIntegrationPoints(_Tetrahedra, order + 0); @@ -484,7 +483,7 @@ FEI3dTetLin :: giveIntegrationRule(int order) const } std::unique_ptr -FEI3dTetLin :: giveBoundaryIntegrationRule(int order, int boundary) const +FEI3dTetLin :: giveBoundaryIntegrationRule(int order, int boundary, Element_Geometry_Type egt) const { auto iRule = std::make_unique(1, nullptr); int points = iRule->getRequiredNumberOfIntegrationPoints(_Triangle, order + 0); diff --git a/src/oofemlib/fei3dtetlin.h b/src/oofemlib/fei3dtetlin.h index 0ecadc8ff..6a4613a2c 100644 --- a/src/oofemlib/fei3dtetlin.h +++ b/src/oofemlib/fei3dtetlin.h @@ -46,11 +46,11 @@ class OOFEM_EXPORT FEI3dTetLin : public FEInterpolation3d public: FEI3dTetLin() : FEInterpolation3d(1) { } - integrationDomain giveIntegrationDomain() const override { return _Tetrahedra; } - Element_Geometry_Type giveGeometryType() const override { return EGT_tetra_1; } - integrationDomain giveBoundaryIntegrationDomain(int ib) const override { return _Triangle; } - integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf) const override { return _Triangle; } - integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge) const override { return _Line; } + integrationDomain giveIntegrationDomain(const Element_Geometry_Type) const override { return _Tetrahedra; } + const Element_Geometry_Type giveGeometryType() const override { return EGT_tetra_1; } + integrationDomain giveBoundaryIntegrationDomain(int ib, const Element_Geometry_Type) const override { return _Triangle; } + integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf, const Element_Geometry_Type) const override { return _Triangle; } + integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge, const Element_Geometry_Type) const override { return _Line; } // Bulk static FloatArrayF<4> evalN(const FloatArrayF<3> &lcoords); @@ -61,7 +61,7 @@ class OOFEM_EXPORT FEI3dTetLin : public FEInterpolation3d void local2global(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; int global2local(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; double giveTransformationJacobian(const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; - int giveNumberOfNodes() const override { return 4; } + int giveNumberOfNodes(const Element_Geometry_Type) const override { return 4; } void giveCellDofMans(IntArray& nodes, IntArray& internalDofMans, Element* elem) const override {nodes={1,2,3,4}; internalDofMans={};} // Edge @@ -80,8 +80,8 @@ class OOFEM_EXPORT FEI3dTetLin : public FEInterpolation3d IntArray computeLocalSurfaceMapping(int iedge) const override; double evalNXIntegral(int iEdge, const FEICellGeometry &cellgeo) const override; - std::unique_ptr giveIntegrationRule(int order) const override; - std::unique_ptr giveBoundaryIntegrationRule(int order, int boundary) const override; + std::unique_ptr giveIntegrationRule(int order, const Element_Geometry_Type) const override; + std::unique_ptr giveBoundaryIntegrationRule(int order, int boundary, const Element_Geometry_Type) const override; protected: double edgeComputeLength(const IntArray &edgeNodes, const FEICellGeometry &cellgeo) const; diff --git a/src/oofemlib/fei3dtetquad.C b/src/oofemlib/fei3dtetquad.C index 53df56d89..f0b16e923 100644 --- a/src/oofemlib/fei3dtetquad.C +++ b/src/oofemlib/fei3dtetquad.C @@ -411,7 +411,7 @@ void FEI3dTetQuad :: edgeEvaldNdx(FloatMatrix &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const { - const auto &edgeNodes = this->computeLocalEdgeMapping(iedge); + //const auto &edgeNodes = this->computeLocalEdgeMapping(iedge); ///@todo Implement this OOFEM_ERROR("Not supported"); } @@ -434,10 +434,10 @@ FEI3dTetQuad :: edgeLocal2global(FloatArray &answer, int iedge, double FEI3dTetQuad :: edgeGiveTransformationJacobian(int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const { - const auto &edgeNodes = this->computeLocalEdgeMapping(iedge); + //const auto &edgeNodes = this->computeLocalEdgeMapping(iedge); ///@todo Implement this OOFEM_ERROR("Not supported"); - return -1; + //return -1; } @@ -458,7 +458,6 @@ FEI3dTetQuad :: computeLocalEdgeMapping(int iedge) const return {3, 4, 10}; } else { throw std::range_error("invalid edge number"); - return {}; } } @@ -467,7 +466,6 @@ FEI3dTetQuad :: edgeComputeLength(const IntArray &edgeNodes, const FEICellGeomet { ///@todo Implement this OOFEM_ERROR("Not supported"); - return -1; } void @@ -658,7 +656,7 @@ double FEI3dTetQuad :: evalNXIntegral(int iEdge, const FEICellGeometry &cellgeo) } std::unique_ptr -FEI3dTetQuad :: giveIntegrationRule(int order) const +FEI3dTetQuad :: giveIntegrationRule(int order, Element_Geometry_Type egt) const { auto iRule = std::make_unique(1, nullptr); int points = iRule->getRequiredNumberOfIntegrationPoints(_Tetrahedra, order + 3); @@ -667,7 +665,7 @@ FEI3dTetQuad :: giveIntegrationRule(int order) const } std::unique_ptr -FEI3dTetQuad :: giveBoundaryIntegrationRule(int order, int boundary) const +FEI3dTetQuad :: giveBoundaryIntegrationRule(int order, int boundary, Element_Geometry_Type egt) const { auto iRule = std::make_unique(1, nullptr); int points = iRule->getRequiredNumberOfIntegrationPoints(_Triangle, order + 2); diff --git a/src/oofemlib/fei3dtetquad.h b/src/oofemlib/fei3dtetquad.h index 06f61d891..c85f5c3f1 100644 --- a/src/oofemlib/fei3dtetquad.h +++ b/src/oofemlib/fei3dtetquad.h @@ -48,11 +48,11 @@ class OOFEM_EXPORT FEI3dTetQuad : public FEInterpolation3d public: FEI3dTetQuad() : FEInterpolation3d(2) { } - integrationDomain giveIntegrationDomain() const override { return _Tetrahedra; } - Element_Geometry_Type giveGeometryType() const override { return EGT_tetra_2; } - integrationDomain giveBoundaryIntegrationDomain(int ib) const override { return _Triangle; } - integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf) const override { return _Triangle; } - integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge) const override { return _Line; } + integrationDomain giveIntegrationDomain(const Element_Geometry_Type) const override { return _Tetrahedra; } + const Element_Geometry_Type giveGeometryType() const override { return EGT_tetra_2; } + integrationDomain giveBoundaryIntegrationDomain(int ib, const Element_Geometry_Type) const override { return _Triangle; } + integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf, const Element_Geometry_Type) const override { return _Triangle; } + integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge, const Element_Geometry_Type) const override { return _Line; } double giveVolume(const FEICellGeometry &cellgeo) const override; @@ -67,7 +67,7 @@ class OOFEM_EXPORT FEI3dTetQuad : public FEInterpolation3d void giveJacobianMatrixAt(FloatMatrix &jacobianMatrix, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; void local2global(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; int global2local(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; - int giveNumberOfNodes() const override { return 10; } + int giveNumberOfNodes(const Element_Geometry_Type) const override { return 10; } void giveCellDofMans(IntArray& nodes, IntArray& internalDofMans, Element* elem) const override {nodes={1,2,3,4,5,6,7,8,9,10}; internalDofMans={};} /** * Returns a characteristic length of the geometry, typically a diagonal or edge length. @@ -92,8 +92,8 @@ class OOFEM_EXPORT FEI3dTetQuad : public FEInterpolation3d IntArray computeLocalSurfaceMapping(int iedge) const override; double evalNXIntegral(int iEdge, const FEICellGeometry &cellgeo) const override; - std::unique_ptr giveIntegrationRule(int order) const override; - std::unique_ptr giveBoundaryIntegrationRule(int order, int boundary) const override; + std::unique_ptr giveIntegrationRule(int order, const Element_Geometry_Type) const override; + std::unique_ptr giveBoundaryIntegrationRule(int order, int boundary, const Element_Geometry_Type) const override; protected: double edgeComputeLength(const IntArray &edgeNodes, const FEICellGeometry &cellgeo) const; diff --git a/src/oofemlib/fei3dtrlin.C b/src/oofemlib/fei3dtrlin.C index f71f076b2..653477292 100644 --- a/src/oofemlib/fei3dtrlin.C +++ b/src/oofemlib/fei3dtrlin.C @@ -51,7 +51,7 @@ double FEI3dTrLin :: evaldNdx(FloatMatrix &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const { OOFEM_ERROR("FEI3dTrLin :: evaldNdx - Not supported"); - return 0.; + //return 0.; } @@ -97,7 +97,7 @@ int FEI3dTrLin :: global2local(FloatArray &answer, const FloatArray &gcoords, const FEICellGeometry &cellgeo) const { OOFEM_ERROR("FEI3dTrLin :: global2local - Not supported"); - return -1; + //return -1; } @@ -153,7 +153,7 @@ FEI3dTrLin :: edgeLocal2global(FloatArray &answer, int iedge, double FEI3dTrLin :: edgeGiveTransformationJacobian(int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const { - const auto &edgeNodes = this->computeLocalEdgeMapping(iedge); + //const auto &edgeNodes = this->computeLocalEdgeMapping(iedge); ///@todo Implement this OOFEM_ERROR("FEI3dTrLin :: edgeGiveTransformationJacobian - Not supported"); return -1; @@ -171,7 +171,7 @@ FEI3dTrLin :: computeLocalEdgeMapping(int iedge) const return { 3, 1 }; } else { throw std::range_error("invalid edge number"); - return {}; + //return {}; } } @@ -180,7 +180,7 @@ FEI3dTrLin :: edgeComputeLength(const IntArray &edgeNodes, const FEICellGeometry { ///@todo Implement this OOFEM_ERROR("FEI3dTrLin :: edgeComputeLength - Not supported"); - return -1; + //return -1; } void @@ -281,7 +281,7 @@ double FEI3dTrLin :: surfaceGiveTransformationJacobian(int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const { OOFEM_ERROR("FEI3dTrLin :: surfaceGiveTransformationJacobian - Not supported yet"); - return 0; + //return 0; } IntArray @@ -293,7 +293,7 @@ FEI3dTrLin :: computeLocalSurfaceMapping(int isurf) const } std::unique_ptr -FEI3dTrLin :: giveIntegrationRule(int order) const +FEI3dTrLin :: giveIntegrationRule(int order, Element_Geometry_Type egt) const { auto iRule = std::make_unique(1, nullptr); int points = iRule->getRequiredNumberOfIntegrationPoints(_Triangle, order); @@ -302,11 +302,11 @@ FEI3dTrLin :: giveIntegrationRule(int order) const } std::unique_ptr -FEI3dTrLin :: giveBoundaryIntegrationRule(int order, int boundary) const +FEI3dTrLin :: giveBoundaryIntegrationRule(int order, int boundary, Element_Geometry_Type egt) const { ///@todo Not sure about what defines boundaries on these elements. 2 surfaces + 3 edges? Ask Jim about this. OOFEM_ERROR("FEI3dTrLin :: giveBoundaryIntegrationRule - Not supported"); - return nullptr; + //return nullptr; } diff --git a/src/oofemlib/fei3dtrlin.h b/src/oofemlib/fei3dtrlin.h index d7cc77827..9c32765d5 100644 --- a/src/oofemlib/fei3dtrlin.h +++ b/src/oofemlib/fei3dtrlin.h @@ -48,11 +48,11 @@ class OOFEM_EXPORT FEI3dTrLin : public FEInterpolation3d public: FEI3dTrLin() : FEInterpolation3d(2) { } - integrationDomain giveIntegrationDomain() const override { return _Triangle; } - Element_Geometry_Type giveGeometryType() const override { return EGT_triangle_1; } - integrationDomain giveBoundaryIntegrationDomain(int ib) const override { return _Line; } - integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf) const override { return _Triangle; } - integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge) const override { return _Line; } + integrationDomain giveIntegrationDomain(const Element_Geometry_Type) const override { return _Triangle; } + const Element_Geometry_Type giveGeometryType() const override { return EGT_triangle_1; } + integrationDomain giveBoundaryIntegrationDomain(int ib, const Element_Geometry_Type) const override { return _Line; } + integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf, const Element_Geometry_Type) const override { return _Triangle; } + integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge, const Element_Geometry_Type) const override { return _Line; } // Bulk void evalN(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; @@ -73,7 +73,7 @@ class OOFEM_EXPORT FEI3dTrLin : public FEInterpolation3d double edgeGiveTransformationJacobian(int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; IntArray computeLocalEdgeMapping(int iedge) const override; - int giveNumberOfEdges() const override { return 3; } + int giveNumberOfEdges(const Element_Geometry_Type) const override { return 3; } // Surface void surfaceEvalN(FloatArray &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; @@ -87,11 +87,11 @@ class OOFEM_EXPORT FEI3dTrLin : public FEInterpolation3d void surfaceEvalBaseVectorsAt(FloatArray &G1, FloatArray &G2, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const ; void surfaceGiveJacobianMatrixAt(FloatMatrix &jacobianMatrix, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const ; - std::unique_ptr giveIntegrationRule(int order) const override; - std::unique_ptr giveBoundaryIntegrationRule(int order, int boundary) const override; + std::unique_ptr giveIntegrationRule(int order, const Element_Geometry_Type) const override; + std::unique_ptr giveBoundaryIntegrationRule(int order, int boundary, const Element_Geometry_Type) const override; double giveArea(const FEICellGeometry &cellgeo) const; - int giveNumberOfNodes() const override { return 3; } + int giveNumberOfNodes(const Element_Geometry_Type) const override { return 3; } protected: double edgeComputeLength(const IntArray &edgeNodes, const FEICellGeometry &cellgeo) const; diff --git a/src/oofemlib/fei3dtrquad.C b/src/oofemlib/fei3dtrquad.C index ce5097832..394813e76 100644 --- a/src/oofemlib/fei3dtrquad.C +++ b/src/oofemlib/fei3dtrquad.C @@ -50,7 +50,7 @@ double FEI3dTrQuad :: evaldNdx(FloatMatrix &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const { OOFEM_ERROR("FEI3dTrQuad :: evaldNdx - Not supported"); - return 0.; + //return 0.; } @@ -101,7 +101,7 @@ FEI3dTrQuad :: giveDerivativeEta(FloatArray &n, const FloatArray &lc) const void -FEI3dTrQuad :: giveLocalNodeCoords(FloatMatrix &answer) const +FEI3dTrQuad :: giveLocalNodeCoords(FloatMatrix &answer,const Element_Geometry_Type) const { answer.resize(3,6); @@ -252,7 +252,7 @@ FEI3dTrQuad :: computeLocalEdgeMapping(int iedge) const return {3, 1, 6}; } else { throw std::range_error("invalid edge number"); - return {}; + //return {}; } } @@ -261,7 +261,7 @@ FEI3dTrQuad :: edgeComputeLength(const IntArray &edgeNodes, const FEICellGeometr { ///@todo Implement this OOFEM_ERROR("Not supported"); - return -1; + //return -1; } void @@ -370,7 +370,7 @@ double FEI3dTrQuad :: surfaceGiveTransformationJacobian(int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const { OOFEM_ERROR("Not supported yet"); - return 0; + //return 0; } IntArray @@ -384,7 +384,7 @@ FEI3dTrQuad :: computeLocalSurfaceMapping(int isurf) const } std::unique_ptr -FEI3dTrQuad :: giveIntegrationRule(int order) const +FEI3dTrQuad :: giveIntegrationRule(int order, Element_Geometry_Type egt) const { auto iRule = std::make_unique(1, nullptr); int points = iRule->getRequiredNumberOfIntegrationPoints(_Triangle, order); @@ -393,11 +393,11 @@ FEI3dTrQuad :: giveIntegrationRule(int order) const } std::unique_ptr -FEI3dTrQuad :: giveBoundaryIntegrationRule(int order, int boundary) const +FEI3dTrQuad :: giveBoundaryIntegrationRule(int order, int boundary, Element_Geometry_Type egt) const { ///@todo Not sure about what defines boundaries on these elements. 2 surfaces + 3 edges? Ask Jim about this. OOFEM_ERROR("FEI3dTrQuad :: giveBoundaryIntegrationRule - Not supported"); - return nullptr; + //return nullptr; } diff --git a/src/oofemlib/fei3dtrquad.h b/src/oofemlib/fei3dtrquad.h index fca64ada0..e29a85148 100644 --- a/src/oofemlib/fei3dtrquad.h +++ b/src/oofemlib/fei3dtrquad.h @@ -49,12 +49,12 @@ class OOFEM_EXPORT FEI3dTrQuad : public FEInterpolation3d public: FEI3dTrQuad() : FEInterpolation3d(2) { } - integrationDomain giveIntegrationDomain() const override { return _Triangle; } - Element_Geometry_Type giveGeometryType() const override { return EGT_triangle_2; } + integrationDomain giveIntegrationDomain(const Element_Geometry_Type) const override { return _Triangle; } + const Element_Geometry_Type giveGeometryType() const override { return EGT_triangle_2; } - integrationDomain giveBoundaryIntegrationDomain(int ib) const override { return _Triangle; } - integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf) const override { return _Triangle; } - integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge) const override { return _Line; } + integrationDomain giveBoundaryIntegrationDomain(int ib, const Element_Geometry_Type) const override { return _Triangle; } + integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf, const Element_Geometry_Type) const override { return _Triangle; } + integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge, const Element_Geometry_Type) const override { return _Line; } // Bulk void evalN(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; @@ -67,7 +67,7 @@ class OOFEM_EXPORT FEI3dTrQuad : public FEInterpolation3d // new methods void giveDerivativeXi(FloatArray &n, const FloatArray &lcoords) const; void giveDerivativeEta(FloatArray &n, const FloatArray &lcoords) const ; - void giveLocalNodeCoords(FloatMatrix &answer) const override; + void giveLocalNodeCoords(FloatMatrix &answer, const Element_Geometry_Type) const override; void surfaceEvaldNdxi(FloatMatrix &answer, const FloatArray &lcoords) const ; // Edge @@ -78,7 +78,7 @@ class OOFEM_EXPORT FEI3dTrQuad : public FEInterpolation3d double edgeGiveTransformationJacobian(int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; IntArray computeLocalEdgeMapping(int iedge) const override; - int giveNumberOfEdges() const override { return 3; } + int giveNumberOfEdges(const Element_Geometry_Type) const override { return 3; } // Surface void surfaceEvalN(FloatArray &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; @@ -90,11 +90,11 @@ class OOFEM_EXPORT FEI3dTrQuad : public FEInterpolation3d void surfaceEvalBaseVectorsAt(FloatArray &G1, FloatArray &G2, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const ; void surfaceGiveJacobianMatrixAt(FloatMatrix &jacobianMatrix, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const ; - std::unique_ptr giveIntegrationRule(int order) const override; - std::unique_ptr giveBoundaryIntegrationRule(int order, int boundary) const override; + std::unique_ptr giveIntegrationRule(int order, const Element_Geometry_Type) const override; + std::unique_ptr giveBoundaryIntegrationRule(int order, int boundary, const Element_Geometry_Type) const override; double giveArea(const FEICellGeometry &cellgeo) const; - int giveNumberOfNodes() const override { return 6; } + int giveNumberOfNodes(const Element_Geometry_Type) const override { return 6; } protected: double edgeComputeLength(const IntArray &edgeNodes, const FEICellGeometry &cellgeo) const; diff --git a/src/oofemlib/fei3dwedgelin.C b/src/oofemlib/fei3dwedgelin.C index 7da14427b..5339a52cd 100644 --- a/src/oofemlib/fei3dwedgelin.C +++ b/src/oofemlib/fei3dwedgelin.C @@ -331,7 +331,7 @@ FEI3dWedgeLin :: computeLocalEdgeMapping(int iedge) const return {3, 6}; } else { throw std::range_error("invalid edge number"); - return {}; + // return {}; } } @@ -340,7 +340,7 @@ double FEI3dWedgeLin :: edgeGiveTransformationJacobian(int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const { OOFEM_ERROR("not implemented"); - return 0.0; + // return 0.0; } @@ -396,7 +396,7 @@ FEI3dWedgeLin :: computeLocalSurfaceMapping(int isurf) const return {3, 1, 4, 6}; } else { throw std::range_error("invalid surface number"); - return {}; + //return {}; } } @@ -406,12 +406,12 @@ FEI3dWedgeLin :: surfaceGiveTransformationJacobian(int isurf, const FloatArray & const FEICellGeometry &cellgeo) const { OOFEM_ERROR("not implemented"); - return 0; + // return 0; } std::unique_ptr -FEI3dWedgeLin :: giveIntegrationRule(int order) const +FEI3dWedgeLin :: giveIntegrationRule(int order, Element_Geometry_Type egt) const { auto iRule = std::make_unique(1, nullptr); ///@todo This function below isn't supported for wedges. We must decide how we should do this. @@ -425,7 +425,7 @@ FEI3dWedgeLin :: giveIntegrationRule(int order) const std::unique_ptr -FEI3dWedgeLin :: giveBoundaryIntegrationRule(int order, int boundary) const +FEI3dWedgeLin :: giveBoundaryIntegrationRule(int order, int boundary, Element_Geometry_Type egt) const { auto iRule = std::make_unique(1, nullptr); if ( boundary <= 2 ) { diff --git a/src/oofemlib/fei3dwedgelin.h b/src/oofemlib/fei3dwedgelin.h index 3cebce3f2..0f665c60f 100644 --- a/src/oofemlib/fei3dwedgelin.h +++ b/src/oofemlib/fei3dwedgelin.h @@ -50,15 +50,15 @@ class OOFEM_EXPORT FEI3dWedgeLin : public FEInterpolation3d public: FEI3dWedgeLin() : FEInterpolation3d(1) { } - integrationDomain giveIntegrationDomain() const override { return _Wedge; } - Element_Geometry_Type giveGeometryType() const override { return EGT_wedge_1; } - integrationDomain giveBoundaryIntegrationDomain(int ib) const override + integrationDomain giveIntegrationDomain(const Element_Geometry_Type) const override { return _Wedge; } + const Element_Geometry_Type giveGeometryType() const override { return EGT_wedge_1; } + integrationDomain giveBoundaryIntegrationDomain(int ib, const Element_Geometry_Type) const override { if (ib <= 2) return _Triangle; else return _Square; } - integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf) const override { return this->giveBoundaryIntegrationDomain(isurf); } - integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge) const override { return _Line; } + integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf, const Element_Geometry_Type egt) const override { return this->giveBoundaryIntegrationDomain(isurf, egt); } + integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge, const Element_Geometry_Type) const override { return _Line; } // Bulk static FloatArrayF<6> evalN(const FloatArrayF<3> &lcoords); @@ -88,12 +88,12 @@ class OOFEM_EXPORT FEI3dWedgeLin : public FEInterpolation3d double surfaceGiveTransformationJacobian(int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; IntArray computeLocalSurfaceMapping(int iSurf) const override; - std::unique_ptr giveIntegrationRule(int order) const override; - std::unique_ptr giveBoundaryIntegrationRule(int order, int boundary) const override; - std::unique_ptr giveSurfaceIntegrationRule(int order, int isurf) const - { return giveBoundaryIntegrationRule(order, isurf); } + std::unique_ptr giveIntegrationRule(int order, const Element_Geometry_Type) const override; + std::unique_ptr giveBoundaryIntegrationRule(int order, int boundary, const Element_Geometry_Type) const override; + std::unique_ptr giveSurfaceIntegrationRule(int order, int isurf, const Element_Geometry_Type egt) const + { return giveBoundaryIntegrationRule(order, isurf, egt); } - int giveNumberOfNodes() const override { return 6; } + int giveNumberOfNodes(const Element_Geometry_Type) const override { return 6; } protected: double edgeComputeLength(IntArray &edgeNodes, const FEICellGeometry &cellgeo) const; diff --git a/src/oofemlib/fei3dwedgequad.C b/src/oofemlib/fei3dwedgequad.C index b708b3684..22390ba83 100644 --- a/src/oofemlib/fei3dwedgequad.C +++ b/src/oofemlib/fei3dwedgequad.C @@ -221,7 +221,7 @@ FEI3dWedgeQuad :: evaldNdx(FloatMatrix &answer, const FloatArray &lcoords, const void -FEI3dWedgeQuad :: giveLocalNodeCoords(FloatMatrix &answer) const +FEI3dWedgeQuad :: giveLocalNodeCoords(FloatMatrix &answer, const Element_Geometry_Type) const { answer.resize(3,15); @@ -402,7 +402,7 @@ FEI3dWedgeQuad :: computeLocalEdgeMapping(int iedge) const return {3, 6, 15}; } else { throw std::range_error("invalid edge number"); - return {}; + //return {}; } } @@ -410,7 +410,7 @@ FEI3dWedgeQuad :: computeLocalEdgeMapping(int iedge) const double FEI3dWedgeQuad :: edgeGiveTransformationJacobian(int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const { OOFEM_ERROR("not implemented"); - return 0.0; + // return 0.0; } @@ -478,7 +478,7 @@ FEI3dWedgeQuad :: computeLocalSurfaceMapping(int isurf) const return {3, 1, 4, 6, 9, 13, 12, 15}; } else { OOFEM_ERROR("Surface %d doesn't exist.\n", isurf); - return {}; + // return {}; } } @@ -556,7 +556,7 @@ FEI3dWedgeQuad :: surfaceGiveTransformationJacobian(int isurf, const FloatArray std::unique_ptr -FEI3dWedgeQuad :: giveIntegrationRule(int order) const +FEI3dWedgeQuad :: giveIntegrationRule(int order, Element_Geometry_Type egt) const { auto iRule = std::make_unique(1, nullptr); ///@todo This function below isn't supported. We must decide on how to deal with wedges. @@ -569,7 +569,7 @@ FEI3dWedgeQuad :: giveIntegrationRule(int order) const } std::unique_ptr -FEI3dWedgeQuad :: giveBoundaryIntegrationRule(int order, int boundary) const +FEI3dWedgeQuad :: giveBoundaryIntegrationRule(int order, int boundary, Element_Geometry_Type egt) const { auto iRule = std::make_unique(1, nullptr); if ( boundary <= 2 ) { diff --git a/src/oofemlib/fei3dwedgequad.h b/src/oofemlib/fei3dwedgequad.h index 295358e4f..deac780d3 100644 --- a/src/oofemlib/fei3dwedgequad.h +++ b/src/oofemlib/fei3dwedgequad.h @@ -52,15 +52,15 @@ class OOFEM_EXPORT FEI3dWedgeQuad : public FEInterpolation3d public: FEI3dWedgeQuad() : FEInterpolation3d(1) { } - integrationDomain giveIntegrationDomain() const override { return _Wedge; } - Element_Geometry_Type giveGeometryType() const override { return EGT_wedge_2; } - integrationDomain giveBoundaryIntegrationDomain(int ib) const override + integrationDomain giveIntegrationDomain(const Element_Geometry_Type) const override { return _Wedge; } + const Element_Geometry_Type giveGeometryType() const override { return EGT_wedge_2; } + integrationDomain giveBoundaryIntegrationDomain(int ib, const Element_Geometry_Type) const override { if (ib <= 2) return _Triangle; else return _Square; } - integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf) const override { return this->giveBoundaryIntegrationDomain(isurf); } - integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge) const override { return _Line; } + integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf, const Element_Geometry_Type egt) const override { return this->giveBoundaryIntegrationDomain(isurf, egt); } + integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge, const Element_Geometry_Type) const override { return _Line; } static FloatArrayF<15> evalN(const FloatArrayF<3> &lcoords); static std::pair> evaldNdx(const FloatArrayF<3> &lcoords, const FEICellGeometry &cellgeo); @@ -77,7 +77,7 @@ class OOFEM_EXPORT FEI3dWedgeQuad : public FEInterpolation3d // Edge void edgeEvalN(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; void edgeEvaldNdx(FloatMatrix &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; - void giveLocalNodeCoords(FloatMatrix &answer) const override; + void giveLocalNodeCoords(FloatMatrix &answer, const Element_Geometry_Type) const override; void edgeLocal2global(FloatArray &answer, int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; double edgeGiveTransformationJacobian(int iedge, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; IntArray computeLocalEdgeMapping(int iedge) const override; @@ -91,12 +91,12 @@ class OOFEM_EXPORT FEI3dWedgeQuad : public FEInterpolation3d void giveJacobianMatrixAt(FloatMatrix &jacobianMatrix, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; - std::unique_ptr giveIntegrationRule(int order) const override; - std::unique_ptr giveBoundaryIntegrationRule(int order, int boundary) const override; - std::unique_ptr giveSurfaceIntegrationRule(int order, int isurf) const - { return giveBoundaryIntegrationRule(order, isurf); } + std::unique_ptr giveIntegrationRule(int order, const Element_Geometry_Type) const override; + std::unique_ptr giveBoundaryIntegrationRule(int order, int boundary, const Element_Geometry_Type) const override; + std::unique_ptr giveSurfaceIntegrationRule(int order, int isurf, const Element_Geometry_Type egt) const + { return giveBoundaryIntegrationRule(order, isurf, egt); } - int giveNumberOfNodes() const override { return 15; } + int giveNumberOfNodes(const Element_Geometry_Type) const override { return 15; } protected: double edgeComputeLength(IntArray &edgeNodes, const FEICellGeometry &cellgeo) const; diff --git a/src/oofemlib/feinterpol.C b/src/oofemlib/feinterpol.C index 37647db68..0ee5be573 100644 --- a/src/oofemlib/feinterpol.C +++ b/src/oofemlib/feinterpol.C @@ -49,9 +49,9 @@ FEInterpolation :: giveTransformationJacobian(const FloatArray &lcoords, const F std::unique_ptr -FEInterpolation:: giveIntegrationRule(int order) const +FEInterpolation:: giveIntegrationRule(int order, Element_Geometry_Type egt) const { - integrationDomain id = this->giveIntegrationDomain(); + integrationDomain id = this->giveIntegrationDomain(egt); auto iRule = std::make_unique(1, nullptr); int points = iRule->getRequiredNumberOfIntegrationPoints(id, order + this->order); @@ -60,9 +60,9 @@ FEInterpolation:: giveIntegrationRule(int order) const } std::unique_ptr -FEInterpolation::giveBoundaryIntegrationRule(int order, int boundary) const +FEInterpolation::giveBoundaryIntegrationRule(int order, int boundary, Element_Geometry_Type egt) const { - integrationDomain id = this->giveBoundaryIntegrationDomain(boundary); + integrationDomain id = this->giveBoundaryIntegrationDomain(boundary, egt); auto iRule = std::make_unique(1, nullptr); int points = iRule->getRequiredNumberOfIntegrationPoints(id, order + this->order); @@ -71,9 +71,9 @@ FEInterpolation::giveBoundaryIntegrationRule(int order, int boundary) const } std::unique_ptr -FEInterpolation::giveBoundaryEdgeIntegrationRule(int order, int boundary) const +FEInterpolation::giveBoundaryEdgeIntegrationRule(int order, int boundary, Element_Geometry_Type egt) const { - integrationDomain id = this->giveBoundaryEdgeIntegrationDomain(boundary); + integrationDomain id = this->giveBoundaryEdgeIntegrationDomain(boundary, egt); auto iRule = std::make_unique(1, nullptr); int points = iRule->getRequiredNumberOfIntegrationPoints(id, order + this->order); @@ -82,9 +82,9 @@ FEInterpolation::giveBoundaryEdgeIntegrationRule(int order, int boundary) const } std::unique_ptr -FEInterpolation::giveBoundarySurfaceIntegrationRule(int order, int boundary) const +FEInterpolation::giveBoundarySurfaceIntegrationRule(int order, int boundary, Element_Geometry_Type egt) const { - integrationDomain id = this->giveBoundarySurfaceIntegrationDomain(boundary); + integrationDomain id = this->giveBoundarySurfaceIntegrationDomain(boundary, egt); auto iRule = std::make_unique(1, nullptr); int points = iRule->getRequiredNumberOfIntegrationPoints(id, order + this->order); diff --git a/src/oofemlib/feinterpol.h b/src/oofemlib/feinterpol.h index 7dbdd4f54..73bc53da4 100644 --- a/src/oofemlib/feinterpol.h +++ b/src/oofemlib/feinterpol.h @@ -35,7 +35,7 @@ #ifndef feinterpol_h #define feinterpol_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "error.h" #include "inputrecord.h" #include "intarray.h" @@ -69,6 +69,7 @@ class OOFEM_EXPORT FEICellGeometry virtual ~FEICellGeometry() { } virtual int giveNumberOfVertices() const = 0; virtual const FloatArray &giveVertexCoordinates(int i) const = 0; + virtual const Element_Geometry_Type giveGeometryType() const = 0; }; @@ -85,12 +86,14 @@ class OOFEM_EXPORT FEIVoidCellGeometry : public FEICellGeometry int giveNumberOfVertices() const override { OOFEM_ERROR("no reference geometry"); - return 0; } const FloatArray &giveVertexCoordinates(int i) const override { OOFEM_ERROR("no reference geometry"); - return tmp; + } + const Element_Geometry_Type giveGeometryType() const override + { + return EGT_unknown; } std :: string errorInfo(const char *func) const { return func; } ///@todo Class name? }; @@ -111,6 +114,9 @@ class OOFEM_EXPORT FEIElementGeometryWrapper : public FEICellGeometry { return elem->giveNode(i)->giveCoordinates(); } + const Element_Geometry_Type giveGeometryType() const override { + return elem->giveGeometryType(); + } }; @@ -121,13 +127,15 @@ class OOFEM_EXPORT FEIVertexListGeometryWrapper : public FEICellGeometry { protected: const std::vector< FloatArray > &coords; + Element_Geometry_Type gtype; public: - FEIVertexListGeometryWrapper(const std::vector< FloatArray > &coords) : - FEICellGeometry(), coords(coords) { } + FEIVertexListGeometryWrapper(const std::vector< FloatArray > &coords, const Element_Geometry_Type gt) : + FEICellGeometry(), coords(coords), gtype(gt) { } virtual ~FEIVertexListGeometryWrapper() { } int giveNumberOfVertices() const override { return (int)this->coords.size(); } const FloatArray &giveVertexCoordinates(int i) const override { return this->coords [ i - 1 ]; } + const Element_Geometry_Type giveGeometryType() const override {return gtype;} }; /** @@ -150,11 +158,11 @@ class OOFEM_EXPORT FEInterpolation /** * Returns the integration domain of the interpolator. */ - virtual integrationDomain giveIntegrationDomain() const = 0; + virtual integrationDomain giveIntegrationDomain(const Element_Geometry_Type) const = 0; /** * Returns the geometry type fo the interpolator. */ - virtual Element_Geometry_Type giveGeometryType() const = 0; + virtual const Element_Geometry_Type giveGeometryType() const = 0; /** * Returns the interpolation order. */ @@ -209,7 +217,7 @@ class OOFEM_EXPORT FEInterpolation /** * Returns a matrix containing the local coordinates for each node corresponding to the interpolation */ - virtual void giveLocalNodeCoords(FloatMatrix &answer) const + virtual void giveLocalNodeCoords(FloatMatrix &answer, const Element_Geometry_Type) const { OOFEM_ERROR("FEInterpolation::giveLocalNodeCoords: not implemented"); } @@ -251,7 +259,7 @@ class OOFEM_EXPORT FEInterpolation * The required polynomial order for the determinant of the jacobian is added automatically. * @param order Polynomial order of integrand (should NOT including determinant of jacobian). */ - virtual std::unique_ptr giveIntegrationRule(int order) const; + virtual std::unique_ptr giveIntegrationRule(int order, const Element_Geometry_Type) const; //@} /** @name Edge boundary functions. @@ -297,20 +305,20 @@ class OOFEM_EXPORT FEInterpolation */ virtual void boundaryEdgeLocal2Global(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const = 0; /// Returns boundary integration domain - virtual integrationDomain giveBoundaryEdgeIntegrationDomain(int boundary) const = 0; + virtual integrationDomain giveBoundaryEdgeIntegrationDomain(int boundary, const Element_Geometry_Type) const = 0; /** * Sets up a suitable integration rule for integrating over the requested boundary. * The required polynomial order for the determinant of the jacobian is added automatically. * @param order Polynomial order of the integrand (should NOT including determinant of jacobian). * @param boundary Boundary number. */ - virtual std::unique_ptr giveBoundaryEdgeIntegrationRule(int order, int boundary) const ; + virtual std::unique_ptr giveBoundaryEdgeIntegrationRule(int order, int boundary, const Element_Geometry_Type) const ; /** * Gives the boundary nodes for requested boundary number. * @param answer Array to be filled with the boundary nodes. * @param boundary Boundary number. */ - virtual IntArray boundaryEdgeGiveNodes(int boundary) const = 0; + virtual IntArray boundaryEdgeGiveNodes(int boundary, const Element_Geometry_Type) const = 0; //@} /**@name Surface interpolation services @@ -362,20 +370,20 @@ class OOFEM_EXPORT FEInterpolation */ virtual double boundarySurfaceGiveTransformationJacobian(int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const = 0; /// Returns boundary integration domain - virtual integrationDomain giveBoundarySurfaceIntegrationDomain(int boundary) const = 0; + virtual integrationDomain giveBoundarySurfaceIntegrationDomain(int boundary, const Element_Geometry_Type) const = 0; /** * Sets up a suitable integration rule for integrating over the requested boundary. * The required polynomial order for the determinant of the jacobian is added automatically. * @param order Polynomial order of the integrand (should NOT including determinant of jacobian). * @param boundary Boundary number. */ - virtual std::unique_ptr giveBoundarySurfaceIntegrationRule(int order, int boundary) const ; + virtual std::unique_ptr giveBoundarySurfaceIntegrationRule(int order, int boundary, const Element_Geometry_Type) const ; /** * Gives the boundary nodes for requested boundary number. * @param answer Array to be filled with the boundary nodes. * @param boundary Boundary number. */ - virtual IntArray boundarySurfaceGiveNodes(int boundary) const = 0; + virtual IntArray boundarySurfaceGiveNodes(int boundary, const Element_Geometry_Type) const = 0; //@} /** @name General boundary interpolation functions. @@ -390,7 +398,7 @@ class OOFEM_EXPORT FEInterpolation * @param answer Array to be filled with the boundary nodes. * @param boundary Boundary number. */ - virtual IntArray boundaryGiveNodes(int boundary) const = 0; + virtual IntArray boundaryGiveNodes(int boundary, const Element_Geometry_Type) const = 0; /** * Evaluates the basis functions on the requested boundary. * Only basis functions that are nonzero anywhere on the boundary are given. Ordering can be obtained from giveBoundaryNodes. @@ -437,17 +445,16 @@ class OOFEM_EXPORT FEInterpolation virtual double evalNXIntegral(int boundary, const FEICellGeometry &cellgeo) const { OOFEM_ERROR("Not implemented"); - return 0.; } /// Returns boundary integration domain - virtual integrationDomain giveBoundaryIntegrationDomain(int boundary) const = 0; + virtual integrationDomain giveBoundaryIntegrationDomain(int boundary, const Element_Geometry_Type) const = 0; /** * Sets up a suitable integration rule for integrating over the requested boundary. * The required polynomial order for the determinant of the jacobian is added automatically. * @param order Polynomial order of the integrand (should NOT including determinant of jacobian). * @param boundary Boundary number. */ - virtual std::unique_ptr giveBoundaryIntegrationRule(int order, int boundary) const; + virtual std::unique_ptr giveBoundaryIntegrationRule(int order, int boundary, const Element_Geometry_Type) const; //@} /**@name Methods to support interpolation defined on patch by patch basis. */ @@ -487,19 +494,19 @@ class OOFEM_EXPORT FEInterpolation /** * Returns number of spatial dimensions. */ - virtual int giveNsd() const = 0; + virtual int giveNsd(const Element_Geometry_Type) const = 0; /** * Returns number of edges. */ - virtual int giveNumberOfEdges() const - { OOFEM_ERROR("FEInterpolation :: giveNumberOfEdges : Not overloaded."); return -1; } + virtual int giveNumberOfEdges(const Element_Geometry_Type) const + { OOFEM_ERROR("FEInterpolation :: giveNumberOfEdges : Not overloaded."); } //@} /** * Returns the number of geometric nodes of the receiver. */ - virtual int giveNumberOfNodes() const - { OOFEM_ERROR("giveNumberOfNodes: Not overloaded."); return -1; } + virtual int giveNumberOfNodes(const Element_Geometry_Type) const + { OOFEM_ERROR("giveNumberOfNodes: Not overloaded."); } //@} std :: string errorInfo(const char *func) const { return func; } ///@todo Class name? diff --git a/src/oofemlib/feinterpol1d.C b/src/oofemlib/feinterpol1d.C index cc3a949cb..49c4b9d53 100644 --- a/src/oofemlib/feinterpol1d.C +++ b/src/oofemlib/feinterpol1d.C @@ -46,7 +46,7 @@ void FEInterpolation1d :: boundaryEvalN(FloatArray &answer, int boundary, const answer.at(1) = 1.; } -IntArray FEInterpolation1d :: boundaryGiveNodes(int boundary) const +IntArray FEInterpolation1d :: boundaryGiveNodes(int boundary, Element_Geometry_Type egt) const { throw std::runtime_error("Not implemented"); } @@ -54,7 +54,6 @@ IntArray FEInterpolation1d :: boundaryGiveNodes(int boundary) const double FEInterpolation1d :: boundaryEvalNormal(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const { OOFEM_ERROR("Not implemented"); - return 1.; } double FEInterpolation1d :: boundaryGiveTransformationJacobian(int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const @@ -67,7 +66,7 @@ void FEInterpolation1d :: boundaryLocal2Global(FloatArray &answer, int boundary, answer = cellgeo.giveVertexCoordinates(boundary); } -std::unique_ptr FEInterpolation1d :: giveIntegrationRule(int order) const +std::unique_ptr FEInterpolation1d :: giveIntegrationRule(int order, Element_Geometry_Type egt) const { auto iRule = std::make_unique(1, nullptr); int points = iRule->getRequiredNumberOfIntegrationPoints(_Line, order + this->order); @@ -75,15 +74,15 @@ std::unique_ptr FEInterpolation1d :: giveIntegrationRule(int or return std::move(iRule); } -std::unique_ptr FEInterpolation1d :: giveBoundaryIntegrationRule(int order, int boundary) const +std::unique_ptr FEInterpolation1d :: giveBoundaryIntegrationRule(int order, int boundary, Element_Geometry_Type egt) const { auto iRule = std::make_unique(1, nullptr); iRule->SetUpPoint(_Unknown); return std::move(iRule); } -std::unique_ptr FEInterpolation1d :: giveBoundaryEdgeIntegrationRule(int order, int boundary) const +std::unique_ptr FEInterpolation1d :: giveBoundaryEdgeIntegrationRule(int order, int boundary, Element_Geometry_Type egt) const { - return this->giveIntegrationRule(order); + return this->giveIntegrationRule(order, egt); } } // end namespace oofem diff --git a/src/oofemlib/feinterpol1d.h b/src/oofemlib/feinterpol1d.h index f05b4083f..99f1dae3e 100644 --- a/src/oofemlib/feinterpol1d.h +++ b/src/oofemlib/feinterpol1d.h @@ -46,11 +46,11 @@ class OOFEM_EXPORT FEInterpolation1d : public FEInterpolation { public: FEInterpolation1d(int o) : FEInterpolation(o) { } - int giveNsd() const override { return 1; } + int giveNsd(const Element_Geometry_Type) const override { return 1; } //FloatArray giveParametricCenter() const override { return {0.}; } - IntArray boundaryGiveNodes(int boundary) const override; + IntArray boundaryGiveNodes(int boundary, const Element_Geometry_Type) const override; void boundaryEvalN(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; double boundaryEvalNormal(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; double boundaryGiveTransformationJacobian(int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; @@ -68,7 +68,7 @@ class OOFEM_EXPORT FEInterpolation1d : public FEInterpolation { OOFEM_ERROR("Functions not supported for this interpolator."); } double boundarySurfaceGiveTransformationJacobian(int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override { OOFEM_ERROR("Functions not supported for this interpolator."); } - IntArray boundarySurfaceGiveNodes(int boundary) const override + IntArray boundarySurfaceGiveNodes(int boundary, const Element_Geometry_Type) const override { throw std::runtime_error("Functions not supported for this interpolator."); } //@} @@ -91,12 +91,11 @@ class OOFEM_EXPORT FEInterpolation1d : public FEInterpolation virtual double giveLength(const FEICellGeometry &cellgeo) const { OOFEM_ERROR("Not implemented in subclass."); - return 0; } - std::unique_ptr giveIntegrationRule(int order) const override; - std::unique_ptr giveBoundaryIntegrationRule(int order, int boundary) const override; - std::unique_ptr giveBoundaryEdgeIntegrationRule(int order, int boundary) const override; + std::unique_ptr giveIntegrationRule(int order, const Element_Geometry_Type) const override; + std::unique_ptr giveBoundaryIntegrationRule(int order, int boundary, const Element_Geometry_Type) const override; + std::unique_ptr giveBoundaryEdgeIntegrationRule(int order, int boundary, const Element_Geometry_Type) const override; }; } // end namespace oofem #endif // feinterpol1d_h diff --git a/src/oofemlib/feinterpol2d.C b/src/oofemlib/feinterpol2d.C index 6955a3907..a0f08ec9a 100644 --- a/src/oofemlib/feinterpol2d.C +++ b/src/oofemlib/feinterpol2d.C @@ -37,7 +37,7 @@ #include "gaussintegrationrule.h" namespace oofem { -IntArray FEInterpolation2d :: boundaryEdgeGiveNodes(int boundary) const +IntArray FEInterpolation2d :: boundaryEdgeGiveNodes(int boundary, Element_Geometry_Type egt) const { return this->computeLocalEdgeMapping(boundary); } @@ -66,7 +66,6 @@ double FEInterpolation2d :: boundaryEdgeEvalNormal(FloatArray &answer, int isurf double FEInterpolation2d :: giveArea(const FEICellGeometry &cellgeo) const { OOFEM_ERROR("Not implemented in subclass."); - return 0; } #define POINT_TOL 1.e-3 @@ -141,7 +140,7 @@ bool FEInterpolation2d ::inside(const FloatArray &lcoords) const OOFEM_ERROR("Not implemented.") } -IntArray FEInterpolation2d :: boundaryGiveNodes(int boundary) const +IntArray FEInterpolation2d :: boundaryGiveNodes(int boundary, Element_Geometry_Type egt) const { return this->computeLocalEdgeMapping(boundary); } @@ -213,9 +212,9 @@ double FEInterpolation2d::boundarySurfaceGiveTransformationJacobian(int isurf, c return this->giveTransformationJacobian(lcoords, cellgeo); } -IntArray FEInterpolation2d::boundarySurfaceGiveNodes(int boundary) const +IntArray FEInterpolation2d::boundarySurfaceGiveNodes(int boundary, Element_Geometry_Type egt) const { - int nnode = this->giveNumberOfNodes(); + int nnode = this->giveNumberOfNodes(egt); IntArray answer(nnode); answer.enumerate(nnode); return answer; diff --git a/src/oofemlib/feinterpol2d.h b/src/oofemlib/feinterpol2d.h index 5b5761fb5..58b97a0cf 100644 --- a/src/oofemlib/feinterpol2d.h +++ b/src/oofemlib/feinterpol2d.h @@ -50,7 +50,7 @@ class OOFEM_EXPORT FEInterpolation2d : public FEInterpolation public: FEInterpolation2d(int o, int ind1, int ind2) : FEInterpolation(o), xind(ind1), yind(ind2) { } - int giveNsd() const override { return 2; } + int giveNsd(const Element_Geometry_Type) const override { return 2; } /** * Computes the exact area. @@ -81,14 +81,14 @@ class OOFEM_EXPORT FEInterpolation2d : public FEInterpolation than the interpolation represents */ //@{ - IntArray boundaryEdgeGiveNodes(int boundary) const override; + IntArray boundaryEdgeGiveNodes(int boundary, const Element_Geometry_Type) const override; void boundaryEdgeEvalN(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; double boundaryEdgeEvalNormal(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; double boundaryEdgeGiveTransformationJacobian(int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; void boundaryEdgeLocal2Global(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; - IntArray boundaryGiveNodes(int boundary) const override; + IntArray boundaryGiveNodes(int boundary, const Element_Geometry_Type) const override; void boundaryEvalN(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; double boundaryEvalNormal(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; double boundaryGiveTransformationJacobian(int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; @@ -102,7 +102,7 @@ class OOFEM_EXPORT FEInterpolation2d : public FEInterpolation double boundarySurfaceEvalNormal(FloatArray &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; void boundarySurfaceLocal2global(FloatArray &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; double boundarySurfaceGiveTransformationJacobian(int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; - IntArray boundarySurfaceGiveNodes(int boundary) const override; + IntArray boundarySurfaceGiveNodes(int boundary, const Element_Geometry_Type) const override; //@} /**@name Edge interpolation services. */ diff --git a/src/oofemlib/feinterpol3d.C b/src/oofemlib/feinterpol3d.C index 6f9c49285..338d3156f 100644 --- a/src/oofemlib/feinterpol3d.C +++ b/src/oofemlib/feinterpol3d.C @@ -37,13 +37,12 @@ #include "gaussintegrationrule.h" namespace oofem { -double FEInterpolation3d :: giveVolume(const FEICellGeometry &cellgeo) const +double FEInterpolation3d::giveVolume(const FEICellGeometry& cellgeo) const { OOFEM_ERROR("Not implemented in subclass."); - return 0; } -IntArray FEInterpolation3d :: boundaryEdgeGiveNodes(int boundary) const +IntArray FEInterpolation3d :: boundaryEdgeGiveNodes(int boundary, Element_Geometry_Type egt) const { return this->computeLocalEdgeMapping(boundary); } @@ -63,7 +62,7 @@ void FEInterpolation3d :: boundaryEdgeLocal2Global(FloatArray &answer, int bound this->edgeLocal2global(answer, boundary, lcoords, cellgeo); } -IntArray FEInterpolation3d :: boundaryGiveNodes(int boundary) const +IntArray FEInterpolation3d :: boundaryGiveNodes(int boundary, Element_Geometry_Type egt) const { return this->computeLocalSurfaceMapping(boundary); } @@ -110,7 +109,7 @@ IntArray FEInterpolation3d :: computeSurfaceMapping(const IntArray &elemNodes, i return surfNodes; } -std::unique_ptr FEInterpolation3d :: giveBoundaryEdgeIntegrationRule(int order, int boundary) const +std::unique_ptr FEInterpolation3d :: giveBoundaryEdgeIntegrationRule(int order, int boundary, Element_Geometry_Type egt) const { auto iRule = std::make_unique(1, nullptr); int points = iRule->getRequiredNumberOfIntegrationPoints(_Line, order + this->order); @@ -131,16 +130,14 @@ void FEInterpolation3d :: surfaceEvaldNdx(FloatMatrix &answer, int isurf, const double FEInterpolation3d :: surfaceEvalNormal(FloatArray &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const { OOFEM_ERROR("Not implemented"); - return -1.0; } double FEInterpolation3d :: edgeEvalNormal(FloatArray &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const { OOFEM_ERROR("Not implemented"); - return -1.0; } -IntArray FEInterpolation3d::boundarySurfaceGiveNodes(int boundary) const +IntArray FEInterpolation3d::boundarySurfaceGiveNodes(int boundary, Element_Geometry_Type egt) const { return this->computeLocalSurfaceMapping(boundary); } diff --git a/src/oofemlib/feinterpol3d.h b/src/oofemlib/feinterpol3d.h index 8cf53b4bf..001d33d75 100644 --- a/src/oofemlib/feinterpol3d.h +++ b/src/oofemlib/feinterpol3d.h @@ -45,7 +45,7 @@ class OOFEM_EXPORT FEInterpolation3d : public FEInterpolation { public: FEInterpolation3d(int o) : FEInterpolation(o) { } - int giveNsd() const override { return 3; } + int giveNsd(const Element_Geometry_Type) const override { return 3; } /** * Computes the exact volume. @@ -54,7 +54,7 @@ class OOFEM_EXPORT FEInterpolation3d : public FEInterpolation */ virtual double giveVolume(const FEICellGeometry &cellgeo) const; - IntArray boundaryEdgeGiveNodes(int boundary) const override; + IntArray boundaryEdgeGiveNodes(int boundary, const Element_Geometry_Type) const override; void boundaryEdgeEvalN(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; double boundaryEdgeGiveTransformationJacobian(int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; void boundaryEdgeLocal2Global(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; @@ -73,7 +73,7 @@ class OOFEM_EXPORT FEInterpolation3d : public FEInterpolation double boundarySurfaceGiveTransformationJacobian(int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override { return this->surfaceGiveTransformationJacobian(isurf, lcoords, cellgeo); } - IntArray boundaryGiveNodes(int boundary) const override; + IntArray boundaryGiveNodes(int boundary, const Element_Geometry_Type) const override; void boundaryEvalN(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; double boundaryEvalNormal(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; double boundaryGiveTransformationJacobian(int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; @@ -190,13 +190,12 @@ class OOFEM_EXPORT FEInterpolation3d : public FEInterpolation IntArray computeSurfaceMapping(const IntArray &elemNodes, int isurf) const; //@} - std::unique_ptr giveBoundaryEdgeIntegrationRule(int order, int boundary) const override; - std::unique_ptr giveBoundaryIntegrationRule(int order, int boundary) const override + std::unique_ptr giveBoundaryEdgeIntegrationRule(int order, int boundary, const Element_Geometry_Type) const override; + std::unique_ptr giveBoundaryIntegrationRule(int order, int boundary, const Element_Geometry_Type) const override { OOFEM_ERROR("Not overloaded"); - return nullptr; }; - IntArray boundarySurfaceGiveNodes(int boundary) const override; + IntArray boundarySurfaceGiveNodes(int boundary, Element_Geometry_Type) const override; }; } // end namespace oofem #endif // feinterpol3d_h diff --git a/src/oofemlib/femcmpnn.h b/src/oofemlib/femcmpnn.h index 48e4d5d28..288bf323d 100644 --- a/src/oofemlib/femcmpnn.h +++ b/src/oofemlib/femcmpnn.h @@ -43,7 +43,7 @@ #include -#include "oofemcfg.h" +#include "oofemenv.h" #include "interfacetype.h" #include "contextioresulttype.h" #include "contextmode.h" diff --git a/src/oofemlib/field.h b/src/oofemlib/field.h index e36067ae1..a456f2f0b 100644 --- a/src/oofemlib/field.h +++ b/src/oofemlib/field.h @@ -35,7 +35,7 @@ #ifndef field_h #define field_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "valuemodetype.h" #include "contextioresulttype.h" #include "contextmode.h" diff --git a/src/oofemlib/fieldmanager.h b/src/oofemlib/fieldmanager.h index e831a1cf4..062e59c40 100644 --- a/src/oofemlib/fieldmanager.h +++ b/src/oofemlib/fieldmanager.h @@ -35,7 +35,7 @@ #ifndef fieldmanager_h #define fieldmanager_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "field.h" #include diff --git a/src/oofemlib/floatarray.C b/src/oofemlib/floatarray.C index 2aed31184..56459cc34 100644 --- a/src/oofemlib/floatarray.C +++ b/src/oofemlib/floatarray.C @@ -52,9 +52,9 @@ #include #define FAST_RESIZE(newsize) \ - if ( (newsize) < this->giveSize() ) { \ + if ( (newsize) < this->size() ) { \ this->values.resize((newsize)); \ - } else if ( (newsize) > this->giveSize() ) { \ + } else if ( (newsize) > this->size() ) { \ this->values.assign((newsize), 0.); \ } @@ -84,9 +84,9 @@ bool FloatArray :: isFinite() const void FloatArray :: beScaled(double s, const FloatArray &b) { - FAST_RESIZE(b.giveSize()); + FAST_RESIZE(b.size()); - for ( int i = 0; i < this->giveSize(); ++i ) { + for ( std::size_t i = 0; i < this->size(); ++i ) { (*this) [ i ] = s * b [ i ]; } } @@ -101,13 +101,13 @@ void FloatArray :: add(const FloatArray &b) return; } - if ( !this->giveSize() ) { + if ( !this->size() ) { * this = b; return; } # ifndef NDEBUG - if ( this->giveSize() != b.giveSize() ) { + if ( this->size() != b.size() ) { OOFEM_ERROR("dimension mismatch in a[%d]->add(b[%d])", this->giveSize(), b.giveSize()); } @@ -119,7 +119,7 @@ void FloatArray :: add(const FloatArray &b) int size = this->giveSize(); daxpy_(& size, & s, b.givePointer(), & inc, this->givePointer(), & inc, b.giveSize(), this->giveSize()); #else - for ( int i = 0; i < this->giveSize(); i++ ) { + for ( std::size_t i = 0; i < this->size(); i++ ) { (*this) [ i ] += b [ i ]; } #endif @@ -144,7 +144,7 @@ void FloatArray :: add(double factor, const FloatArray &b) } # ifndef NDEBUG - if ( this->giveSize() != b.giveSize() ) { + if ( this->size() != b.size() ) { OOFEM_ERROR("dimension mismatch in a[%d]->add(b[%d])", this->giveSize(), b.giveSize()); } @@ -155,7 +155,7 @@ void FloatArray :: add(double factor, const FloatArray &b) int size = this->giveSize(); daxpy_(& size, & factor, b.givePointer(), & inc, this->givePointer(), & inc, b.giveSize(), this->giveSize()); #else - for ( int i = 0; i < this->giveSize(); ++i ) { + for ( std::size_t i = 0; i < this->size(); ++i ) { (*this) [ i ] += factor * b [ i ]; } #endif @@ -165,8 +165,8 @@ void FloatArray :: add(double factor, const FloatArray &b) void FloatArray :: plusProduct(const FloatMatrix &b, const FloatArray &s, double dV) // Performs the operation a += b^T . s * dV { - int nRows = b.giveNumberOfRows(); - int nColumns = b.giveNumberOfColumns(); + std::size_t nRows = b.giveNumberOfRows(); + std::size_t nColumns = b.giveNumberOfColumns(); if ( this->isEmpty() ) { this->values.assign( nColumns, 0. ); @@ -183,9 +183,9 @@ void FloatArray :: plusProduct(const FloatMatrix &b, const FloatArray &s, double int inc = 1; dgemv_("t", & nRows, & nColumns, & dV, b.givePointer(), & nRows, s.givePointer(), & inc, & beta, this->givePointer(), & inc, nColumns, nColumns, nRows); #else - for ( int i = 1; i <= nColumns; i++ ) { + for ( std::size_t i = 1; i <= nColumns; i++ ) { double sum = 0.; - for ( int j = 1; j <= nRows; j++ ) { + for ( std::size_t j = 1; j <= nRows; j++ ) { sum += b.at(j, i) * s.at(j); } this->at(i) += sum * dV; @@ -203,8 +203,8 @@ void FloatArray :: subtract(const FloatArray &src) } if ( this->isEmpty() ) { - FAST_RESIZE(src.giveSize()); - for ( int i = 0; i < this->giveSize(); ++i ) { + FAST_RESIZE(src.size()); + for ( std::size_t i = 0; i < this->size(); ++i ) { (*this) [ i ] = -src [ i ]; } @@ -212,13 +212,13 @@ void FloatArray :: subtract(const FloatArray &src) } # ifndef NDEBUG - if ( this->giveSize() != src.giveSize() ) { + if ( this->size() != src.size() ) { OOFEM_ERROR("dimension mismatch in a[%d]->add(b[%d])", this->giveSize(), src.giveSize()); } # endif - for ( int i = 0; i < this->giveSize(); ++i ) { + for ( std::size_t i = 0; i < this->size(); ++i ) { (*this) [ i ] -= src [ i ]; } } @@ -226,18 +226,18 @@ void FloatArray :: subtract(const FloatArray &src) void FloatArray :: beMaxOf(const FloatArray &a, const FloatArray &b) { - int n = a.giveSize(); + std::size_t n = a.size(); - if ( a.giveSize() == 0 ) { + if ( a.size() == 0 ) { *this = b; return; - } else if ( b.giveSize() == 0 ) { + } else if ( b.size() == 0 ) { *this = a; return; } # ifndef NDEBUG - if ( n != b.giveSize() ) { + if ( n != b.size() ) { OOFEM_ERROR("dimension mismatch in beMaxOf(a[%d],b[%d])", n, b.giveSize()); } @@ -245,7 +245,7 @@ void FloatArray :: beMaxOf(const FloatArray &a, const FloatArray &b) FAST_RESIZE(n); - for ( int i = 0; i < n; i++ ) { + for ( std::size_t i = 0; i < n; i++ ) { (*this) [ i ] = max( a [ i ], b [ i ] ); } } @@ -253,25 +253,25 @@ void FloatArray :: beMaxOf(const FloatArray &a, const FloatArray &b) void FloatArray :: beMinOf(const FloatArray &a, const FloatArray &b) { - int n = a.giveSize(); + std::size_t n = a.size(); - if ( a.giveSize() == 0 ) { + if ( a.size() == 0 ) { *this = b; return; - } else if ( b.giveSize() == 0 ) { + } else if ( b.size() == 0 ) { *this = a; return; } # ifndef NDEBUG - if ( n != b.giveSize() ) { + if ( n != b.size() ) { OOFEM_ERROR("dimension mismatch in beMinOf(a[%d],b[%d])", n, b.giveSize()); } # endif FAST_RESIZE(n); - for ( int i = 0; i < n; i++ ) { + for ( std::size_t i = 0; i < n; i++ ) { (*this) [ i ] = min( a [ i ], b [ i ] ); } } @@ -280,7 +280,7 @@ void FloatArray :: beMinOf(const FloatArray &a, const FloatArray &b) void FloatArray :: beDifferenceOf(const FloatArray &a, const FloatArray &b) { #ifndef NDEBUG - if ( a.giveSize() != b.giveSize() ) { + if ( a.size() != b.size() ) { OOFEM_ERROR("size mismatch (%d : %d)", a.giveSize(), b.giveSize()); } @@ -293,23 +293,23 @@ void FloatArray :: beDifferenceOf(const FloatArray &a, const FloatArray &b) #else this->values.reserve(a.giveSize()); this->values.resize(0); - for ( int i = 0; i < a.giveSize(); ++i ) { + for ( std::size_t i = 0; i < a.size(); ++i ) { this->values.push_back( a[i] - b[i] ); } #endif } -void FloatArray :: beDifferenceOf(const FloatArray &a, const FloatArray &b, int n) +void FloatArray :: beDifferenceOf(const FloatArray &a, const FloatArray &b, std::size_t n) { #ifndef NDEBUG - if ( a.giveSize() < n || b.giveSize() < n ) { + if ( a.size() < n || b.size() < n ) { OOFEM_ERROR("wrong size ", a.giveSize(), b.giveSize()); } #endif FAST_RESIZE(n); - for ( int i = 0; i < n; ++i ) { + for ( std::size_t i = 0; i < n; ++i ) { (*this) [ i ] = a [ i ] - b [ i ]; } } @@ -327,25 +327,25 @@ void FloatArray :: beSubArrayOf(const FloatArray &src, const IntArray &indx) } #endif - int n = indx.giveSize(); + std::size_t n = indx.size(); FAST_RESIZE(n); - for ( int i = 1; i <= n; i++ ) { + for ( std::size_t i = 1; i <= n; i++ ) { this->at(i) = src.at( indx.at(i) ); } } -void FloatArray :: addSubVector(const FloatArray &src, int si) +void FloatArray :: addSubVector(const FloatArray &src, std::size_t si) { - int reqSize, n = src.giveSize(); + std::size_t reqSize, n = src.size(); si--; reqSize = si + n; - if ( this->giveSize() < reqSize ) { + if ( this->size() < reqSize ) { this->resizeWithValues(reqSize); } - for ( int i = 0; i < n; i++ ) { + for (std::size_t i = 0; i < n; i++ ) { (*this) [si + i] += src [ i ]; } } @@ -369,12 +369,12 @@ void FloatArray :: beVectorProductOf(const FloatArray &v1, const FloatArray &v2) int FloatArray :: giveIndexMinElem() { - int index = 1; + std::size_t index = 1; if ( !this->giveSize() ) { return -1; } double val = (*this) [ 0 ]; - for ( int i = 1; i < this->giveSize(); i++ ) { + for (std::size_t i = 1; i < this->size(); i++ ) { if ( val > (*this) [ i ] ) { val = (*this) [ i ]; index = i + 1; @@ -385,12 +385,12 @@ int FloatArray :: giveIndexMinElem() int FloatArray :: giveIndexMaxElem() { - int index = 1; + std::size_t index = 1; if ( !this->giveSize() ) { return -1; } double val = (*this) [ 0 ]; - for ( int i = 1; i < this->giveSize(); i++ ) { + for (std::size_t i = 1; i < this->size(); i++ ) { if ( val < (*this) [ i ] ) { val = (*this) [ i ]; index = i + 1; @@ -402,7 +402,7 @@ int FloatArray :: giveIndexMaxElem() double FloatArray :: dotProduct(const FloatArray &x) const { # ifndef NDEBUG - if ( this->giveSize() != x.giveSize() ) { + if ( this->size() != x.size() ) { OOFEM_ERROR("dimension mismatch in a[%d]->dotProduct(b[%d])", this->giveSize(), x.giveSize()); } @@ -412,10 +412,10 @@ double FloatArray :: dotProduct(const FloatArray &x) const } -double FloatArray :: dotProduct(const FloatArray &x, int size) const +double FloatArray :: dotProduct(const FloatArray &x, std::size_t size) const { # ifndef NDEBUG - if ( size > this->giveSize() || size > x.giveSize() ) { + if ( size > this->size() || size > x.size() ) { OOFEM_ERROR("dimension mismatch in a[%d]->dotProduct(b[%d])", this->giveSize(), x.giveSize()); } @@ -477,8 +477,8 @@ double FloatArray :: distance_square(const FloatArray &from) const // computed using generalized pythagorean formulae { double dist = 0.; - int s = min(this->giveSize(), from.giveSize()); - for ( int i = 1; i <= s; ++i ) { + std::size_t s = min(this->size(), from.size()); + for (std::size_t i = 1; i <= s; ++i ) { double dx = this->at(i) - from.at(i); dist += dx * dx; } @@ -491,15 +491,15 @@ void FloatArray :: assemble(const FloatArray &fe, const IntArray &loc) // Assembles the array fe (typically, the load vector of a finite // element) to the receiver, using loc as location array. { - int n = fe.giveSize(); + std::size_t n = fe.size(); # ifndef NDEBUG - if ( n != loc.giveSize() ) { + if ( n != loc.size() ) { OOFEM_ERROR("dimensions of 'fe' (%d) and 'loc' (%d) mismatch", fe.giveSize(), loc.giveSize() ); } # endif - for ( int i = 1; i <= n; i++ ) { + for (std::size_t i = 1; i <= n; i++ ) { int ii = loc.at(i); if ( ii ) { // if non 0 coefficient, this->at(ii) += fe.at(i); @@ -512,15 +512,15 @@ void FloatArray :: assembleSquared(const FloatArray &fe, const IntArray &loc) // Assembles the array fe (typically, the load vector of a finite // element) to the receiver, using loc as location array. { - int n = fe.giveSize(); + std::size_t n = fe.size(); # ifndef NDEBUG - if ( n != loc.giveSize() ) { + if ( n != loc.size() ) { OOFEM_ERROR("dimensions of 'fe' (%d) and 'loc' (%d) mismatch", fe.giveSize(), loc.giveSize() ); } # endif - for ( int i = 1; i <= n; i++ ) { + for (std::size_t i = 1; i <= n; i++ ) { int ii = loc.at(i); if ( ii ) { // if non 0 coefficient, this->at(ii) += fe.at(i) * fe.at(i); @@ -551,7 +551,7 @@ void FloatArray :: reserve(int s) } -void FloatArray :: resizeWithValues(int n, int allocChunk) +void FloatArray :: resizeWithValues(std::size_t n, std::size_t allocChunk) { #ifndef NDEBUG if ( allocChunk < 0 ) { @@ -560,7 +560,7 @@ void FloatArray :: resizeWithValues(int n, int allocChunk) #endif - if ( allocChunk > 0 && (int)this->values.capacity() < n ) { + if ( allocChunk > 0 && this->values.capacity() < n ) { this->values.reserve(n + allocChunk); } @@ -615,8 +615,8 @@ void FloatArray :: append(double a) void FloatArray :: beProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray) // Stores the product of aMatrix * anArray in to receiver { - int nColumns = aMatrix.giveNumberOfColumns(); - int nRows = aMatrix.giveNumberOfRows(); + std::size_t nColumns = aMatrix.giveNumberOfColumns(); + std::size_t nRows = aMatrix.giveNumberOfRows(); FAST_RESIZE(nRows); @@ -632,9 +632,9 @@ void FloatArray :: beProductOf(const FloatMatrix &aMatrix, const FloatArray &anA int inc = 1; dgemv_("n", & nRows, & nColumns, & alpha, aMatrix.givePointer(), & nRows, anArray.givePointer(), & inc, & beta, this->givePointer(), & inc, nColumns, nColumns, nRows); #else - for ( int i = 1; i <= nRows; i++ ) { + for (std::size_t i = 1; i <= nRows; i++ ) { double sum = 0.; - for ( int j = 1; j <= nColumns; j++ ) { + for (std::size_t j = 1; j <= nColumns; j++ ) { sum += aMatrix.at(i, j) * anArray.at(j); } @@ -647,8 +647,8 @@ void FloatArray :: beProductOf(const FloatMatrix &aMatrix, const FloatArray &anA void FloatArray :: beTProductOf(const FloatMatrix &aMatrix, const FloatArray &anArray) // Stores the product of aMatrix^T * anArray in to receiver { - int nRows = aMatrix.giveNumberOfRows(); - int nColumns = aMatrix.giveNumberOfColumns(); + std::size_t nRows = aMatrix.giveNumberOfRows(); + std::size_t nColumns = aMatrix.giveNumberOfColumns(); # ifndef NDEBUG if ( aMatrix.giveNumberOfRows() != anArray.giveSize() ) { @@ -663,9 +663,9 @@ void FloatArray :: beTProductOf(const FloatMatrix &aMatrix, const FloatArray &an int inc = 1; dgemv_("t", & nRows, & nColumns, & alpha, aMatrix.givePointer(), & nRows, anArray.givePointer(), & inc, & beta, this->givePointer(), & inc, nColumns, nColumns, nRows); #else - for ( int i = 1; i <= nColumns; i++ ) { + for (std::size_t i = 1; i <= nColumns; i++ ) { double sum = 0.; - for ( int j = 1; j <= nRows; j++ ) { + for (std::size_t j = 1; j <= nRows; j++ ) { sum += aMatrix.at(j, i) * anArray.at(j); } @@ -815,7 +815,7 @@ contextIOResultType FloatArray :: storeYourself(DataStream &stream) const // =0 file i/o error { // write size - int size = this->giveSize(); + std::size_t size = this->size(); if ( !stream.write(size) ) { return CIO_IOERR; } @@ -838,7 +838,7 @@ contextIOResultType FloatArray :: restoreYourself(DataStream &stream) // -1 if id od class id is not correct { // read size - int size; + std::size_t size; if ( !stream.read(size) ) { return CIO_IOERR; } @@ -859,7 +859,7 @@ contextIOResultType FloatArray :: restoreYourself(DataStream &stream) int FloatArray :: givePackSize(DataStream &buff) const { - return buff.givePackSizeOfInt(1) + buff.givePackSizeOfDouble(this->giveSize()); + return buff.givePackSizeOfSizet(1) + buff.givePackSizeOfDouble(this->giveSize()); } // IML compat @@ -968,7 +968,7 @@ void FloatArray :: beVectorForm(const FloatMatrix &aMatrix) { // Rewrites the matrix on vector form, order: 11, 22, 33, 23, 13, 12, 32, 31, 21 # ifndef NDEBUG - if ( aMatrix.giveNumberOfColumns() != 3 || aMatrix.giveNumberOfColumns() != 3 ) { + if ( aMatrix.giveNumberOfColumns() != 3 || aMatrix.giveNumberOfRows() != 3 ) { OOFEM_ERROR("matrix dimension is not 3x3"); } @@ -991,7 +991,7 @@ void FloatArray :: beSymVectorFormOfStrain(const FloatMatrix &aMatrix) // Revrites a symmetric strain matrix on reduced vector form, order: 11, 22, 33, 23, 13, 12 // shear components are multiplied with a factor 2 # ifndef NDEBUG - if ( aMatrix.giveNumberOfColumns() != 3 || aMatrix.giveNumberOfColumns() != 3 ) { + if ( aMatrix.giveNumberOfColumns() != 3 || aMatrix.giveNumberOfRows() != 3 ) { OOFEM_ERROR("matrix dimension is not 3x3"); } # endif @@ -1011,7 +1011,7 @@ void FloatArray :: beSymVectorForm(const FloatMatrix &aMatrix) { // Revrites the matrix on vector form (symmetrized matrix used), order: 11, 22, 33, 23, 13, 12 # ifndef NDEBUG - if ( aMatrix.giveNumberOfColumns() != 3 || aMatrix.giveNumberOfColumns() != 3 ) { + if ( aMatrix.giveNumberOfColumns() != 3 || aMatrix.giveNumberOfRows() != 3 ) { OOFEM_ERROR("matrix dimension is not 3x3"); } @@ -1092,10 +1092,10 @@ void FloatArray :: beColumnOf(const FloatMatrix &mat, int col) mat.copyColumn(*this, col); } -void FloatArray :: beRowOf(const FloatMatrix &mat, int row) +void FloatArray :: beRowOf(const FloatMatrix &mat, std::size_t row) { - int nRows = mat.giveNumberOfRows(); - int nColumns = mat.giveNumberOfColumns(); + std::size_t nRows = mat.giveRowSize(); + std::size_t nColumns = mat.giveColSize(); # ifndef NDEBUG if (row>nRows) { @@ -1104,7 +1104,7 @@ void FloatArray :: beRowOf(const FloatMatrix &mat, int row) # endif FAST_RESIZE(nColumns); - for ( int i = 1; i <= nColumns; i++ ) { + for ( std::size_t i = 1; i <= nColumns; i++ ) { this->at(i) = mat.at(row,i); } } diff --git a/src/oofemlib/floatarray.h b/src/oofemlib/floatarray.h index d30c682b5..12b767318 100644 --- a/src/oofemlib/floatarray.h +++ b/src/oofemlib/floatarray.h @@ -35,7 +35,7 @@ #ifndef floatarray_h #define floatarray_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "contextioresulttype.h" #include "contextmode.h" #include "error.h" @@ -136,7 +136,7 @@ class OOFEM_EXPORT FloatArray * position of the receiver. Provides 1-based indexing access. * @param i Position of coefficient in array. */ - inline double &at(int i) + inline double &at(std::size_t i) { #ifndef NDEBUG this->checkBounds( i ); @@ -148,7 +148,7 @@ class OOFEM_EXPORT FloatArray * position of the receiver. Provides 1-based indexing access. * @param i Position of coefficient in array. */ - inline double at(int i) const + inline double at(std::size_t i) const { #ifndef NDEBUG this->checkBounds( i ); @@ -161,11 +161,11 @@ class OOFEM_EXPORT FloatArray * position of the receiver. Provides 0-based indexing access. * @param i Position of coefficient in array. */ - inline double &operator() (int i) { return this->operator[](i); } - inline double &operator[] (int i) + inline double &operator() (std::size_t i) { return this->operator[](i); } + inline double &operator[] (std::size_t i) { #ifndef NDEBUG - if ( i >= this->giveSize() ) { + if ( i >= values.size()) { OOFEM_ERROR( "array error on index : %d >= %d", i, this->giveSize() ); } #endif @@ -176,10 +176,10 @@ class OOFEM_EXPORT FloatArray * position of the receiver. Provides 0-based indexing access. * @param i Position of coefficient in array. */ - inline const double &operator() (int i) const { return this->operator[](i); } - inline const double &operator[] (int i) const { + inline const double &operator() (std::size_t i) const { return this->operator[](i); } + inline const double &operator[] (std::size_t i) const { #ifndef NDEBUG - if ( i >= this->giveSize() ) { + if ( i >= values.size() ) { OOFEM_ERROR( "array error on index : %d >= %d", i, this->giveSize() ); } #endif @@ -191,11 +191,11 @@ class OOFEM_EXPORT FloatArray * mismatch found. * @param i Required size of receiver. */ - void checkBounds(int i) const + void checkBounds(std::size_t i) const { if ( i <= 0 ) { OOFEM_ERROR("array error on index : %d <= 0", i); - } else if ( i > this->giveSize() ) { + } else if ( i > values.size()) { OOFEM_ERROR("array error on index : %d > %d", i, this->giveSize()); } } @@ -217,7 +217,7 @@ class OOFEM_EXPORT FloatArray * @param s New size. * @param allocChunk Additional space to allocate. */ - void resizeWithValues(int s, int allocChunk = 0); + void resizeWithValues(std::size_t s, std::size_t allocChunk = 0); /** * Resizes receiver towards requested size. Array is zeroed. * @param s New size. @@ -240,6 +240,7 @@ class OOFEM_EXPORT FloatArray bool containsOnlyZeroes() const; /// Returns the size of receiver. int giveSize() const { return (int)this->values.size(); } + std::size_t size() const { return this->values.size(); } /// Returns true if receiver is not empty. bool isNotEmpty() const { return !this->values.empty(); } /// Returns true if receiver is empty. @@ -367,7 +368,7 @@ class OOFEM_EXPORT FloatArray * @param b Array which receiver comes from. * @param n Only first n entries are taken. */ - void beDifferenceOf(const FloatArray &a, const FloatArray &b, int n); + void beDifferenceOf(const FloatArray &a, const FloatArray &b, std::size_t n); /** * Extract sub vector form src array and stores the result into receiver. * @param src source vector for sub vector @@ -382,7 +383,7 @@ class OOFEM_EXPORT FloatArray * @param src Sub-vector to be added. * @param si Determines the position (receiver's 1-based index) of first src value to be added. */ - void addSubVector(const FloatArray &src, int si); + void addSubVector(const FloatArray &src, std::size_t si); /** * Assembles the array fe (typically, the load vector of a finite * element) into the receiver, using loc as location array. @@ -448,7 +449,7 @@ class OOFEM_EXPORT FloatArray * @param x Vector to contract to receiver. * @param size Number of elements to contract. May not be larger than */ - double dotProduct(const FloatArray &x, int size) const; + double dotProduct(const FloatArray &x, std::size_t size) const; /** * Normalizes receiver. Euclidean norm is used, after operation receiver @@ -527,7 +528,7 @@ class OOFEM_EXPORT FloatArray /** * Reciever will be set to a given row in a matrix */ - void beRowOf(const FloatMatrix &mat, int row); + void beRowOf(const FloatMatrix &mat, std::size_t row); contextIOResultType storeYourself(DataStream &stream) const; contextIOResultType restoreYourself(DataStream &stream); diff --git a/src/oofemlib/floatarrayf.h b/src/oofemlib/floatarrayf.h index a08e5c82c..374d2e957 100644 --- a/src/oofemlib/floatarrayf.h +++ b/src/oofemlib/floatarrayf.h @@ -35,7 +35,7 @@ #ifndef floatarrayf_h #define floatarrayf_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "contextioresulttype.h" #include "contextmode.h" #include "datastream.h" @@ -96,7 +96,7 @@ class OOFEM_EXPORT FloatArrayF * position of the receiver. Provides 1-based indexing access. * @param i Position of coefficient in array. */ - inline double &at(int i) + inline double &at(std::size_t i) { #ifndef NDEBUG return values.at( i - 1 ); @@ -109,7 +109,7 @@ class OOFEM_EXPORT FloatArrayF * position of the receiver. Provides 1-based indexing access. * @param i Position of coefficient in array. */ - inline double at(int i) const + inline double at(std::size_t i) const { #ifndef NDEBUG return values.at( i - 1 ); @@ -123,7 +123,7 @@ class OOFEM_EXPORT FloatArrayF * position of the receiver. Provides 0-based indexing access. * @param i Position of coefficient in array. */ - inline double &operator[] (int i) + inline double &operator[] (std::size_t i) { #ifndef NDEBUG return values.at( i ); @@ -136,7 +136,7 @@ class OOFEM_EXPORT FloatArrayF * position of the receiver. Provides 0-based indexing access. * @param i Position of coefficient in array. */ - inline const double &operator[] (int i) const { + inline const double &operator[] (std::size_t i) const { #ifndef NDEBUG return values.at( i ); #else @@ -149,7 +149,7 @@ class OOFEM_EXPORT FloatArrayF * @param c Position of coefficient in array. */ template - inline FloatArrayF operator[] (int const (&c)[M]) const + inline FloatArrayF operator[] (std::size_t const (&c)[M]) const { FloatArrayF x; for ( std::size_t i = 0; i < M; ++i ) { diff --git a/src/oofemlib/floatmatrix.C b/src/oofemlib/floatmatrix.C index 8c75b6934..cafc72afb 100644 --- a/src/oofemlib/floatmatrix.C +++ b/src/oofemlib/floatmatrix.C @@ -50,10 +50,10 @@ #define RESIZE(nr, nc) \ { \ this->nRows = nr; this->nColumns = nc; \ - int nsize = this->nRows * this->nColumns; \ - if ( nsize < ( int ) this->values.size() ) { \ + std::size_t nsize = this->nRows * this->nColumns; \ + if ( nsize < this->values.size() ) { \ this->values.resize(nsize); \ - } else if ( nsize > ( int ) this->values.size() ) { \ + } else if ( nsize > this->values.size() ) { \ this->values.assign(nsize, 0.); \ } \ } @@ -129,7 +129,7 @@ FloatMatrix :: FloatMatrix(std :: initializer_list< std :: initializer_list< dou auto p = this->values.begin(); for ( auto col : mat ) { #if DEBUG - if ( this->nRows != ( int ) col.size() ) { + if ( this->nRows != col.size() ) { OOFEM_ERROR("Initializer list has inconsistent column sizes."); } #endif @@ -147,7 +147,7 @@ FloatMatrix &FloatMatrix :: operator = ( std :: initializer_list< std :: initial auto p = this->values.begin(); for ( auto col : mat ) { #if DEBUG - if ( this->nRows != ( int ) col.size() ) { + if ( this->nRows != col.size() ) { OOFEM_ERROR("Initializer list has inconsistent column sizes."); } #endif @@ -167,7 +167,7 @@ FloatMatrix &FloatMatrix :: operator = ( std :: initializer_list< FloatArray >ma auto p = this->values.begin(); for ( auto col : mat ) { #if DEBUG - if ( this->nRows != col.giveSize() ) { + if ( this->nRows != col.size() ) { OOFEM_ERROR("Initializer list has inconsistent column sizes."); } #endif @@ -181,7 +181,7 @@ FloatMatrix &FloatMatrix :: operator = ( std :: initializer_list< FloatArray >ma } -void FloatMatrix :: checkBounds(int i, int j) const +void FloatMatrix :: checkBounds(std::size_t i, std::size_t j) const // Checks that the receiver includes a position (i,j). { if ( i <= 0 ) { @@ -214,10 +214,10 @@ bool FloatMatrix :: isFinite() const void FloatMatrix :: assemble(const FloatMatrix &src, const IntArray &loc) { - int ii, jj, size = src.giveNumberOfRows(); + std::size_t ii, jj, size = src.giveRowSize(); #ifndef NDEBUG - if ( size != loc.giveSize() ) { + if ( size != loc.size() ) { OOFEM_ERROR("dimensions of 'src' and 'loc' mismatch"); } @@ -226,9 +226,9 @@ void FloatMatrix :: assemble(const FloatMatrix &src, const IntArray &loc) } #endif - for ( int i = 1; i <= size; i++ ) { + for ( std::size_t i = 1; i <= size; i++ ) { if ( ( ii = loc.at(i) ) ) { - for ( int j = 1; j <= size; j++ ) { + for ( std::size_t j = 1; j <= size; j++ ) { if ( ( jj = loc.at(j) ) ) { this->at(ii, jj) += src.at(i, j); } @@ -341,10 +341,10 @@ void FloatMatrix :: beProductOf(const FloatMatrix &aMatrix, const FloatMatrix &b & beta, this->givePointer(), & this->nRows, aMatrix.nColumns, bMatrix.nColumns, this->nColumns); # else - for ( int i = 1; i <= aMatrix.nRows; i++ ) { - for ( int j = 1; j <= bMatrix.nColumns; j++ ) { + for ( std::size_t i = 1; i <= aMatrix.nRows; i++ ) { + for ( std::size_t j = 1; j <= bMatrix.nColumns; j++ ) { double coeff = 0.; - for ( int k = 1; k <= aMatrix.nColumns; k++ ) { + for ( std::size_t k = 1; k <= aMatrix.nColumns; k++ ) { coeff += aMatrix.at(i, k) * bMatrix.at(k, j); } @@ -371,10 +371,10 @@ void FloatMatrix :: beTProductOf(const FloatMatrix &aMatrix, const FloatMatrix & & beta, this->givePointer(), & this->nRows, aMatrix.nColumns, bMatrix.nColumns, this->nColumns); # else - for ( int i = 1; i <= aMatrix.nColumns; i++ ) { - for ( int j = 1; j <= bMatrix.nColumns; j++ ) { + for ( std::size_t i = 1; i <= aMatrix.nColumns; i++ ) { + for (std::size_t j = 1; j <= bMatrix.nColumns; j++ ) { double coeff = 0.; - for ( int k = 1; k <= aMatrix.nRows; k++ ) { + for (std::size_t k = 1; k <= aMatrix.nRows; k++ ) { coeff += aMatrix.at(k, i) * bMatrix.at(k, j); } @@ -401,10 +401,10 @@ void FloatMatrix :: beProductTOf(const FloatMatrix &aMatrix, const FloatMatrix & & beta, this->givePointer(), & this->nRows, aMatrix.nColumns, bMatrix.nColumns, this->nColumns); # else - for ( int i = 1; i <= aMatrix.nRows; i++ ) { - for ( int j = 1; j <= bMatrix.nRows; j++ ) { + for (std::size_t i = 1; i <= aMatrix.nRows; i++ ) { + for (std::size_t j = 1; j <= bMatrix.nRows; j++ ) { double coeff = 0.; - for ( int k = 1; k <= aMatrix.nColumns; k++ ) { + for (std::size_t k = 1; k <= aMatrix.nColumns; k++ ) { coeff += aMatrix.at(i, k) * bMatrix.at(j, k); } @@ -434,10 +434,10 @@ void FloatMatrix :: addProductOf(const FloatMatrix &aMatrix, const FloatMatrix & & beta, this->givePointer(), & this->nRows, aMatrix.nColumns, bMatrix.nColumns, this->nColumns); # else - for ( int i = 1; i <= aMatrix.nRows; i++ ) { - for ( int j = 1; j <= bMatrix.nColumns; j++ ) { + for (std::size_t i = 1; i <= aMatrix.nRows; i++ ) { + for (std::size_t j = 1; j <= bMatrix.nColumns; j++ ) { double coeff = 0.; - for ( int k = 1; k <= aMatrix.nColumns; k++ ) { + for (std::size_t k = 1; k <= aMatrix.nColumns; k++ ) { coeff += aMatrix.at(i, k) * bMatrix.at(k, j); } @@ -466,10 +466,10 @@ void FloatMatrix :: addTProductOf(const FloatMatrix &aMatrix, const FloatMatrix & beta, this->givePointer(), & this->nRows, aMatrix.nColumns, bMatrix.nColumns, this->nColumns); # else - for ( int i = 1; i <= aMatrix.nColumns; i++ ) { - for ( int j = 1; j <= bMatrix.nColumns; j++ ) { + for (std::size_t i = 1; i <= aMatrix.nColumns; i++ ) { + for (std::size_t j = 1; j <= bMatrix.nColumns; j++ ) { double coeff = 0.; - for ( int k = 1; k <= aMatrix.nRows; k++ ) { + for (std::size_t k = 1; k <= aMatrix.nRows; k++ ) { coeff += aMatrix.at(k, i) * bMatrix.at(k, j); } @@ -730,10 +730,10 @@ void FloatMatrix :: plusProductSymmUpper(const FloatMatrix &a, const FloatMatrix } } #else - for ( int i = 1; i <= nRows; i++ ) { - for ( int j = i; j <= nColumns; j++ ) { + for (std::size_t i = 1; i <= nRows; i++ ) { + for (std::size_t j = i; j <= nColumns; j++ ) { double summ = 0.; - for ( int k = 1; k <= a.nRows; k++ ) { + for (std::size_t k = 1; k <= a.nRows; k++ ) { summ += a.at(k, i) * b.at(k, j); } @@ -758,8 +758,8 @@ void FloatMatrix :: plusDyadSymmUpper(const FloatArray &a, double dV) this->givePointer(), & this->nRows, sizeA, this->nColumns); #else - for ( int i = 1; i <= nRows; i++ ) { - for ( int j = i; j <= nColumns; j++ ) { + for (std::size_t i = 1; i <= nRows; i++ ) { + for (std::size_t j = i; j <= nColumns; j++ ) { this->at(i, j) += a.at(i) * a.at(j) * dV; } } @@ -785,10 +785,10 @@ void FloatMatrix :: plusProductUnsym(const FloatMatrix &a, const FloatMatrix &b, & beta, this->givePointer(), & this->nRows, a.nColumns, b.nColumns, this->nColumns); #else - for ( int i = 1; i <= nRows; i++ ) { - for ( int j = 1; j <= nColumns; j++ ) { + for (std::size_t i = 1; i <= nRows; i++ ) { + for (std::size_t j = 1; j <= nColumns; j++ ) { double summ = 0.; - for ( int k = 1; k <= a.nRows; k++ ) { + for (std::size_t k = 1; k <= a.nRows; k++ ) { summ += a.at(k, i) * b.at(k, j); } @@ -814,8 +814,8 @@ void FloatMatrix :: plusDyadUnsym(const FloatArray &a, const FloatArray &b, doub b.givePointer(), & inc, this->givePointer(), & this->nRows, sizeA, sizeB, this->nColumns); #else - for ( int i = 1; i <= nRows; i++ ) { - for ( int j = 1; j <= nColumns; j++ ) { + for (std::size_t i = 1; i <= nRows; i++ ) { + for (std::size_t j = 1; j <= nColumns; j++ ) { this->at(i, j) += a.at(i) * b.at(j) * dV; } } @@ -903,40 +903,40 @@ bool FloatMatrix :: beInverseOf(const FloatMatrix &src) FloatMatrix tmp = src; // initialize answer to be unity matrix; this->zero(); - for ( int i = 1; i <= nRows; i++ ) { + for (std::size_t i = 1; i <= nRows; i++ ) { this->at(i, i) = 1.0; } // lower triangle elimination by columns - for ( int i = 1; i < nRows; i++ ) { + for (std::size_t i = 1; i < nRows; i++ ) { piv = tmp.at(i, i); if ( fabs(piv) < 1.e-30 ) { OOFEM_WARNING("pivot (%d,%d) to close to small (< 1.e-20)", i, i); return false; } - for ( int j = i + 1; j <= nRows; j++ ) { + for (std::size_t j = i + 1; j <= nRows; j++ ) { linkomb = tmp.at(j, i) / tmp.at(i, i); - for ( int k = i; k <= nRows; k++ ) { + for (std::size_t k = i; k <= nRows; k++ ) { tmp.at(j, k) -= tmp.at(i, k) * linkomb; } - for ( int k = 1; k <= nRows; k++ ) { + for (std::size_t k = 1; k <= nRows; k++ ) { this->at(j, k) -= this->at(i, k) * linkomb; } } } // upper triangle elimination by columns - for ( int i = nRows; i > 1; i-- ) { + for ( std::size_t i = nRows; i > 1; i-- ) { piv = tmp.at(i, i); - for ( int j = i - 1; j > 0; j-- ) { + for ( std::size_t j = i - 1; j > 0; j-- ) { linkomb = tmp.at(j, i) / piv; - for ( int k = i; k > 0; k-- ) { + for ( std::size_t k = i; k > 0; k-- ) { tmp.at(j, k) -= tmp.at(i, k) * linkomb; } - for ( int k = nRows; k > 0; k-- ) { + for ( std::size_t k = nRows; k > 0; k-- ) { // tmp -> at(j,k)-= tmp ->at(i,k)*linkomb; this->at(j, k) -= this->at(i, k) * linkomb; } @@ -944,8 +944,8 @@ bool FloatMatrix :: beInverseOf(const FloatMatrix &src) } // diagonal scaling - for ( int i = 1; i <= nRows; i++ ) { - for ( int j = 1; j <= nRows; j++ ) { + for ( std::size_t i = 1; i <= nRows; i++ ) { + for ( std::size_t j = 1; j <= nRows; j++ ) { this->at(i, j) /= tmp.at(i, i); } } @@ -956,7 +956,7 @@ bool FloatMatrix :: beInverseOf(const FloatMatrix &src) void FloatMatrix :: beSubMatrixOf(const FloatMatrix &src, - int topRow, int bottomRow, int topCol, int bottomCol) + std::size_t topRow, std::size_t bottomRow, std::size_t topCol, std::size_t bottomCol) /* * modifies receiver to be submatrix of the src matrix * size of receiver submatrix is determined from @@ -975,14 +975,14 @@ void FloatMatrix :: beSubMatrixOf(const FloatMatrix &src, #endif - int topRm1, topCm1; + std::size_t topRm1, topCm1; topRm1 = topRow - 1; topCm1 = topCol - 1; // allocate return value this->resize(bottomRow - topRm1, bottomCol - topCm1); - for ( int i = topRow; i <= bottomRow; i++ ) { - for ( int j = topCol; j <= bottomCol; j++ ) { + for (std::size_t i = topRow; i <= bottomRow; i++ ) { + for (std::size_t j = topCol; j <= bottomCol; j++ ) { this->at(i - topRm1, j - topCm1) = src.at(i, j); } } @@ -1113,7 +1113,7 @@ bool FloatMatrix :: solveForRhs(const FloatArray &b, FloatArray &answer, bool tr OOFEM_ERROR("cannot solve a %d by %d matrix", nRows, nColumns); } - if ( nRows != b.giveSize() ) { + if ( nRows != b.size() ) { OOFEM_ERROR("dimension mismatch"); } # endif @@ -1131,7 +1131,7 @@ bool FloatMatrix :: solveForRhs(const FloatArray &b, FloatArray &answer, bool tr return false; } #else - int pivRow; + std::size_t pivRow; double piv, linkomb, help; FloatMatrix *mtrx, trans; if ( transpose ) { @@ -1145,11 +1145,11 @@ bool FloatMatrix :: solveForRhs(const FloatArray &b, FloatArray &answer, bool tr // initialize answer to be unity matrix; // lower triangle elimination by columns - for ( int i = 1; i < nRows; i++ ) { + for ( std::size_t i = 1; i < nRows; i++ ) { // find the suitable row and pivot piv = fabs( mtrx->at(i, i) ); pivRow = i; - for ( int j = i + 1; j <= nRows; j++ ) { + for (std::size_t j = i + 1; j <= nRows; j++ ) { if ( fabs( mtrx->at(j, i) ) > piv ) { pivRow = j; piv = fabs( mtrx->at(j, i) ); @@ -1162,7 +1162,7 @@ bool FloatMatrix :: solveForRhs(const FloatArray &b, FloatArray &answer, bool tr // exchange rows if ( pivRow != i ) { - for ( int j = i; j <= nRows; j++ ) { + for (std::size_t j = i; j <= nRows; j++ ) { help = mtrx->at(i, j); mtrx->at(i, j) = mtrx->at(pivRow, j); mtrx->at(pivRow, j) = help; @@ -1172,9 +1172,9 @@ bool FloatMatrix :: solveForRhs(const FloatArray &b, FloatArray &answer, bool tr answer.at(pivRow) = help; } - for ( int j = i + 1; j <= nRows; j++ ) { + for (std::size_t j = i + 1; j <= nRows; j++ ) { linkomb = mtrx->at(j, i) / mtrx->at(i, i); - for ( int k = i; k <= nRows; k++ ) { + for (std::size_t k = i; k <= nRows; k++ ) { mtrx->at(j, k) -= mtrx->at(i, k) * linkomb; } @@ -1183,9 +1183,9 @@ bool FloatMatrix :: solveForRhs(const FloatArray &b, FloatArray &answer, bool tr } // back substitution - for ( int i = nRows; i >= 1; i-- ) { + for ( std::size_t i = nRows; i >= 1; i-- ) { help = 0.; - for ( int j = i + 1; j <= nRows; j++ ) { + for ( std::size_t j = i + 1; j <= nRows; j++ ) { help += mtrx->at(i, j) * answer.at(j); } @@ -1209,7 +1209,7 @@ bool FloatMatrix :: solveForRhs(const FloatMatrix &b, FloatMatrix &answer, bool OOFEM_ERROR("cannot solve a %d by %d matrix", nRows, nColumns); } - if ( nRows != b.giveNumberOfRows() ) { + if ( nRows != b.giveRowSize() ) { OOFEM_ERROR("dimension mismatch"); } # endif @@ -1226,7 +1226,7 @@ bool FloatMatrix :: solveForRhs(const FloatMatrix &b, FloatMatrix &answer, bool return false; //OOFEM_ERROR("error %d", info); } #else - int pivRow, nPs; + std::size_t pivRow, nPs; double piv, linkomb, help; FloatMatrix *mtrx, trans; if ( transpose ) { @@ -1240,11 +1240,11 @@ bool FloatMatrix :: solveForRhs(const FloatMatrix &b, FloatMatrix &answer, bool answer = b; // initialize answer to be unity matrix; // lower triangle elimination by columns - for ( int i = 1; i < nRows; i++ ) { + for (std::size_t i = 1; i < nRows; i++ ) { // find the suitable row and pivot piv = fabs( mtrx->at(i, i) ); pivRow = i; - for ( int j = i + 1; j <= nRows; j++ ) { + for (std::size_t j = i + 1; j <= nRows; j++ ) { if ( fabs( mtrx->at(j, i) ) > piv ) { pivRow = j; piv = fabs( mtrx->at(j, i) ); @@ -1257,36 +1257,36 @@ bool FloatMatrix :: solveForRhs(const FloatMatrix &b, FloatMatrix &answer, bool // exchange rows if ( pivRow != i ) { - for ( int j = i; j <= nRows; j++ ) { + for (std::size_t j = i; j <= nRows; j++ ) { help = mtrx->at(i, j); mtrx->at(i, j) = mtrx->at(pivRow, j); mtrx->at(pivRow, j) = help; } - for ( int j = 1; j <= nPs; j++ ) { + for (std::size_t j = 1; j <= nPs; j++ ) { help = answer.at(i, j); answer.at(i, j) = answer.at(pivRow, j); answer.at(pivRow, j) = help; } } - for ( int j = i + 1; j <= nRows; j++ ) { + for (std::size_t j = i + 1; j <= nRows; j++ ) { linkomb = mtrx->at(j, i) / mtrx->at(i, i); - for ( int k = i; k <= nRows; k++ ) { + for (std::size_t k = i; k <= nRows; k++ ) { mtrx->at(j, k) -= mtrx->at(i, k) * linkomb; } - for ( int k = 1; k <= nPs; k++ ) { + for (std::size_t k = 1; k <= nPs; k++ ) { answer.at(j, k) -= answer.at(i, k) * linkomb; } } } // back substitution - for ( int i = nRows; i >= 1; i-- ) { - for ( int k = 1; k <= nPs; k++ ) { + for ( std::size_t i = nRows; i >= 1; i-- ) { + for (std::size_t k = 1; k <= nPs; k++ ) { help = 0.; - for ( int j = i + 1; j <= nRows; j++ ) { + for ( std::size_t j = i + 1; j <= nRows; j++ ) { help += mtrx->at(i, j) * answer.at(j, k); } @@ -1331,7 +1331,7 @@ void FloatMatrix :: beUnitMatrix() #endif this->zero(); - for ( int i = 1; i <= nRows; i++ ) { + for (std::size_t i = 1; i <= nRows; i++ ) { this->at(i, i) = 1.0; } } @@ -1348,7 +1348,7 @@ void FloatMatrix :: bePinvID() } -void FloatMatrix :: resize(int rows, int columns) +void FloatMatrix :: resize(std::size_t rows, std::size_t columns) // // resizes receiver, all data will be lost // @@ -1359,7 +1359,7 @@ void FloatMatrix :: resize(int rows, int columns) } -void FloatMatrix :: resizeWithData(int rows, int columns) +void FloatMatrix :: resizeWithData(std::size_t rows, std::size_t columns) // // resizes receiver, all data kept // @@ -1375,11 +1375,11 @@ void FloatMatrix :: resizeWithData(int rows, int columns) this->nColumns = columns; this->values.resize(rows * columns); - int ii = min( rows, old.giveNumberOfRows() ); - int jj = min( columns, old.giveNumberOfColumns() ); + std::size_t ii = min( rows, old.giveRowSize() ); + std::size_t jj = min( columns, old.giveColSize() ); // copy old values if possible - for ( int i = 1; i <= ii; i++ ) { - for ( int j = 1; j <= jj; j++ ) { + for (std::size_t i = 1; i <= ii; i++ ) { + for (std::size_t j = 1; j <= jj; j++ ) { this->at(i, j) = old.at(i, j); } } @@ -1419,7 +1419,7 @@ double FloatMatrix :: giveDeterminant() const OOFEM_ERROR("sorry, cannot compute the determinant of a matrix larger than 3x3"); } - return 0.; + // return 0.; } @@ -1441,7 +1441,7 @@ double FloatMatrix :: giveTrace() const } # endif double answer = 0.; - for ( int k = 0; k < nRows; k++ ) { + for (std::size_t k = 0; k < nRows; k++ ) { answer += values [ k * ( nRows + 1 ) ]; } return answer; @@ -1451,11 +1451,11 @@ double FloatMatrix :: giveTrace() const void FloatMatrix :: printYourself() const // Prints the receiver on screen. { - printf("FloatMatrix with dimensions : %d %d\n", + printf("FloatMatrix with dimensions : %zu %zu\n", nRows, nColumns); if ( nRows <= 250 && nColumns <= 250 ) { - for ( int i = 1; i <= nRows; ++i ) { - for ( int j = 1; j <= nColumns && j <= 100; ++j ) { + for (std::size_t i = 1; i <= nRows; ++i ) { + for (std::size_t j = 1; j <= nColumns && j <= 100; ++j ) { printf( "%10.3e ", this->at(i, j) ); } @@ -1475,8 +1475,8 @@ void FloatMatrix :: printYourselfToFile(const std::string filename, const bool s if (showDimensions) matrixfile << "FloatMatrix with dimensions : " << nRows << ", " << nColumns << "\n"; matrixfile << std::scientific << std::right << std::setprecision(3); - for ( int i = 1; i <= nRows; ++i ) { - for ( int j = 1; j <= nColumns; ++j ) { + for (std::size_t i = 1; i <= nRows; ++i ) { + for (std::size_t j = 1; j <= nColumns; ++j ) { matrixfile << std::setw(10) << this->at(i, j) << "\t"; } @@ -1492,18 +1492,18 @@ void FloatMatrix :: printYourselfToFile(const std::string filename, const bool s void FloatMatrix :: printYourself(const std::string &name) const // Prints the receiver on screen. { - printf("%s (%d x %d): \n", name.c_str(), nRows, nColumns); + printf("%s (%zu x %zu): \n", name.c_str(), nRows, nColumns); if ( nRows <= 250 && nColumns <= 250 ) { - for ( int i = 1; i <= nRows; ++i ) { - for ( int j = 1; j <= nColumns && j <= 100; ++j ) { + for (std::size_t i = 1; i <= nRows; ++i ) { + for (std::size_t j = 1; j <= nColumns && j <= 100; ++j ) { printf( "%10.3e ", this->at(i, j) ); } printf("\n"); } } else { - for ( int i = 1; i <= nRows && i <= 20; ++i ) { - for ( int j = 1; j <= nColumns && j <= 10; ++j ) { + for (std::size_t i = 1; i <= nRows && i <= 20; ++i ) { + for (std::size_t j = 1; j <= nColumns && j <= 10; ++j ) { printf( "%10.3e ", this->at(i, j) ); } if ( nColumns > 10 ) printf(" ..."); @@ -1518,8 +1518,8 @@ void FloatMatrix :: pY() const // Prints the receiver on screen with higher accuracy than printYourself. { printf("["); - for ( int i = 1; i <= nRows; ++i ) { - for ( int j = 1; j <= nColumns; ++j ) { + for (std::size_t i = 1; i <= nRows; ++i ) { + for (std::size_t j = 1; j <= nColumns; ++j ) { printf( "%20.15e", this->at(i, j) ); if ( j < nColumns ) { printf(","); @@ -1536,8 +1536,8 @@ void FloatMatrix :: pY() const void FloatMatrix :: writeCSV(const std :: string &name) const { FILE *file = fopen(name.c_str(), "w"); - for ( int i = 1; i <= nRows; ++i ) { - for ( int j = 1; j <= nColumns; ++j ) { + for (std::size_t i = 1; i <= nRows; ++i ) { + for (std::size_t j = 1; j <= nColumns; ++j ) { fprintf(file, "%10.3e, ", this->at(i, j) ); } @@ -1576,8 +1576,8 @@ void FloatMatrix :: symmetrized() # endif - for ( int i = 2; i <= nRows; i++ ) { - for ( int j = 1; j < i; j++ ) { + for (std::size_t i = 2; i <= nRows; i++ ) { + for (std::size_t j = 1; j < i; j++ ) { this->at(i, j) = this->at(j, i); } } @@ -1619,9 +1619,9 @@ double FloatMatrix :: computeNorm(char p) const # else if ( p == '1' ) { // Maximum absolute column sum. double col_sum, max_col = 0.0; - for ( int j = 1; j <= this->nColumns; j++ ) { + for (std::size_t j = 1; j <= this->nColumns; j++ ) { col_sum = 0.0; - for ( int i = 1; i <= this->nRows; i++ ) { + for (std::size_t i = 1; i <= this->nRows; i++ ) { col_sum += fabs( this->at(i, j) ); } if ( col_sum > max_col ) { @@ -1640,7 +1640,7 @@ double FloatMatrix :: computeNorm(char p) const * return sqrt(eigs(0)); * } */else { OOFEM_ERROR("p == %d not implemented.\n", p); - return 0.0; + // return 0.0; } # endif } @@ -1897,7 +1897,7 @@ contextIOResultType FloatMatrix :: restoreYourself(DataStream &stream) int FloatMatrix :: givePackSize(DataStream &buff) const { - return buff.givePackSizeOfInt(1) + buff.givePackSizeOfInt(1) + + return buff.givePackSizeOfSizet(1) + buff.givePackSizeOfSizet(1) + buff.givePackSizeOfDouble(nRows * nColumns); } @@ -2090,8 +2090,8 @@ FloatMatrix :: __getitem__(boost :: python :: api :: object t) std :: ostream &operator << ( std :: ostream & out, const FloatMatrix & x ) { out << x.nRows << " " << x.nColumns << " {"; - for ( int i = 0; i < x.nRows; ++i ) { - for ( int j = 0; j < x.nColumns; ++j ) { + for (std::size_t i = 0; i < x.nRows; ++i ) { + for (std::size_t j = 0; j < x.nColumns; ++j ) { out << " " << x(i, j); } out << ";"; diff --git a/src/oofemlib/floatmatrix.h b/src/oofemlib/floatmatrix.h index d1faa1558..633443a48 100644 --- a/src/oofemlib/floatmatrix.h +++ b/src/oofemlib/floatmatrix.h @@ -35,7 +35,7 @@ #ifndef flotmtrx_h #define flotmtrx_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "contextioresulttype.h" #include "contextmode.h" @@ -92,9 +92,9 @@ class OOFEM_EXPORT FloatMatrix { protected: /// Number of rows. - int nRows; + std::size_t nRows; /// Number of columns. - int nColumns; + std::size_t nColumns; /// Values of matrix stored column wise. std :: vector< double >values; @@ -112,7 +112,7 @@ class OOFEM_EXPORT FloatMatrix * @param n Number of rows. * @param m Requested number of columns. */ - FloatMatrix(int n, int m) : nRows(n), nColumns(m), values(n * m) {} + FloatMatrix(std::size_t n, std::size_t m) : nRows(n), nColumns(m), values(n * m) {} /// Creates zero sized matrix. FloatMatrix() : nRows(0), nColumns(0), values() {} /** @@ -165,11 +165,16 @@ class OOFEM_EXPORT FloatMatrix * @param i Required number of rows. * @param j Required number of columns. */ - void checkBounds(int i, int j) const; + void checkBounds(std::size_t i, std::size_t j) const; /// Returns number of rows of receiver. - inline int giveNumberOfRows() const { return nRows; } + inline int giveNumberOfRows() const { return (int)nRows; } + inline std::size_t giveRowSize() const { return nRows; } + /// Returns number of columns of receiver. - inline int giveNumberOfColumns() const { return nColumns; } + inline int giveNumberOfColumns() const { return (int)nColumns; } + inline std::size_t giveColSize() const { return nColumns; } + + /// Returns nonzero if receiver is square matrix. inline bool isSquare() const { return nRows == nColumns; } /// Tests for empty matrix. @@ -184,7 +189,7 @@ class OOFEM_EXPORT FloatMatrix * @param i Row position of coefficient. * @param j Column position of coefficient. */ - inline double at(int i, int j) const + inline double at(std::size_t i, std::size_t j) const { #ifndef NDEBUG this->checkBounds(i, j); @@ -197,7 +202,7 @@ class OOFEM_EXPORT FloatMatrix * @param i Row position of coefficient. * @param j Column position of coefficient. */ - inline double &at(int i, int j) + inline double &at(std::size_t i, std::size_t j) { #ifndef NDEBUG this->checkBounds(i, j); @@ -211,7 +216,7 @@ class OOFEM_EXPORT FloatMatrix * @param i Row position of coefficient. * @param j Column position of coefficient. */ - inline double &operator()(int i, int j) + inline double &operator()(std::size_t i, std::size_t j) { #ifndef NDEBUG this->checkBounds(i + 1, j + 1); @@ -223,7 +228,7 @@ class OOFEM_EXPORT FloatMatrix * @param i Row position of coefficient. * @param j Column position of coefficient. */ - inline double operator()(int i, int j) const + inline double operator()(std::size_t i, std::size_t j) const { #ifndef NDEBUG this->checkBounds(i + 1, j + 1); @@ -383,7 +388,7 @@ class OOFEM_EXPORT FloatMatrix * @param topCol Index of top column of sub-matrix. * @param bottomCol index of bottom column of sub-matrix. */ - void beSubMatrixOf(const FloatMatrix &src, int topRow, int bottomRow, int topCol, int bottomCol); + void beSubMatrixOf(const FloatMatrix &src, std::size_t topRow, std::size_t bottomRow, std::size_t topCol, std::size_t bottomCol); /** * Modifies receiver to be a sub-matrix of another matrix. * @param src Matrix from which sub-matrix is taken @@ -529,13 +534,13 @@ class OOFEM_EXPORT FloatMatrix * @param rows New number of rows. * @param cols New number of columns. */ - void resize(int rows, int cols); + void resize(std::size_t rows, std::size_t cols); /** * Checks size of receiver towards requested bounds. * If dimension mismatch, size is adjusted accordingly. * Note: New coefficients are initialized to zero, old are kept. */ - void resizeWithData(int, int); + void resizeWithData(std::size_t, std::size_t); /** * Resizing that enforces reallocation of memory. * Data is zeroed. diff --git a/src/oofemlib/floatmatrixf.h b/src/oofemlib/floatmatrixf.h index c0248f182..3a12c9b09 100644 --- a/src/oofemlib/floatmatrixf.h +++ b/src/oofemlib/floatmatrixf.h @@ -37,7 +37,7 @@ #ifndef floatmatrixf_h #define floatmatrixf_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "contextioresulttype.h" #include "contextmode.h" #include "floatmatrix.h" @@ -140,7 +140,7 @@ class OOFEM_EXPORT FloatMatrixF * @param i Row position of coefficient. * @param j Column position of coefficient. */ - double at(int i, int j) const + double at(std::size_t i, std::size_t j) const { #ifndef NDEBUG this->checkBounds(i, j); @@ -153,7 +153,7 @@ class OOFEM_EXPORT FloatMatrixF * @param i Row position of coefficient. * @param j Column position of coefficient. */ - inline double &at(int i, int j) + inline double &at(std::size_t i, std::size_t j) { #ifndef NDEBUG this->checkBounds(i, j); @@ -165,7 +165,7 @@ class OOFEM_EXPORT FloatMatrixF * Direct value access (column major). Implements 0-based indexing. * @param i Position in data. */ - double &operator[](int i) + double &operator[](std::size_t i) { return values[ i ]; } @@ -173,7 +173,7 @@ class OOFEM_EXPORT FloatMatrixF * Direct value access (column major). Implements 0-based indexing. * @param i Position in data. */ - double operator[](int i) const + double operator[](std::size_t i) const { return values[ i ]; } @@ -184,7 +184,7 @@ class OOFEM_EXPORT FloatMatrixF * @param i Row position of coefficient. * @param j Column position of coefficient. */ - double &operator()(int i, int j) + double &operator()(std::size_t i, std::size_t j) { #ifndef NDEBUG this->checkBounds(i + 1, j + 1); @@ -196,7 +196,7 @@ class OOFEM_EXPORT FloatMatrixF * @param i Row position of coefficient. * @param j Column position of coefficient. */ - double operator()(int i, int j) const + double operator()(std::size_t i, std::size_t j) const { #ifndef NDEBUG this->checkBounds(i + 1, j + 1); @@ -210,7 +210,7 @@ class OOFEM_EXPORT FloatMatrixF * @param c Columns to extract. */ template - FloatMatrixF operator()(int const (&r)[R], int const (&c)[C]) const + FloatMatrixF operator()(std::size_t const (&r)[R], std::size_t const (&c)[C]) const { FloatMatrixF x; for ( std::size_t i = 0; i < R; ++i ) { @@ -238,7 +238,7 @@ class OOFEM_EXPORT FloatMatrixF * @param src Array to set at column c. * @param c Column to set. */ - void setColumn(const FloatArrayF &src, int c) + void setColumn(const FloatArrayF &src, std::size_t c) { for ( std::size_t i = 0; i < N; i++ ) { (*this)(i, c) = src[i]; @@ -250,7 +250,7 @@ class OOFEM_EXPORT FloatMatrixF * @param src Array to set at column c. * @param c Column to set. */ - FloatArrayF column(int j) const + FloatArrayF column(std::size_t j) const { FloatArrayF c; for ( std::size_t i = 0; i < N; i++ ) { diff --git a/src/oofemlib/fracturemanager.h b/src/oofemlib/fracturemanager.h index db3314e17..515a70699 100644 --- a/src/oofemlib/fracturemanager.h +++ b/src/oofemlib/fracturemanager.h @@ -106,7 +106,7 @@ class FailureCriteriaStatus } FailureCriteriaStatus() { } - ~FailureCriteriaStatus() { } // must destroy object correctly + virtual ~FailureCriteriaStatus() { } // must destroy object correctly Element *el; std :: vector< std :: vector< FloatArray > >quantities; @@ -137,13 +137,13 @@ class FailureCriteria this->number = number; this->fMan = fMan; }; - ~FailureCriteria() { } // must destroy object correctly + virtual ~FailureCriteria() { } // must destroy object correctly std :: vector< FailureCriteriaStatus * >list; FailureCriteriaType giveType() { return this->type; } FractureManager *giveFractureManager() { return this->fMan; } - void setType(FailureCriteriaType type) { this->type = type; } + void setType(FailureCriteriaType _type) { this->type = _type; } virtual void initializeFrom(InputRecord &ir); int instanciateYourself(DataReader &dr); @@ -174,6 +174,7 @@ class DamagedNeighborLayered : public FailureCriteria public: DamagedNeighborLayered(int number, FractureManager * fracMan) : FailureCriteria(number, fracMan) { } + virtual ~DamagedNeighborLayered() {} bool evaluateFailureCriteria(FailureCriteriaStatus *fcStatus) override; const char *giveClassName() const override { return "DamagedNeighborLayered"; } diff --git a/src/oofemlib/function.C b/src/oofemlib/function.C index 8e17a1c43..13073c7eb 100644 --- a/src/oofemlib/function.C +++ b/src/oofemlib/function.C @@ -64,13 +64,13 @@ Function :: evaluate(TimeStep *tStep, ValueModeType mode) return this->evaluateAccelerationAtTime( tStep->giveIntrinsicTime() ); } else if ( mode == VM_Incremental ) { return this->evaluateAtTime( tStep->giveTargetTime() ) - this->evaluateAtTime( tStep->giveTargetTime() - tStep->giveTimeIncrement() ); - } else if (mode == VM_Intermediate) { + } else if ((mode == VM_Intermediate) || (mode == VM_TotalIntrinsic)) { return this->evaluateAtTime( tStep->giveIntrinsicTime() ); } else { OOFEM_ERROR("unsupported mode(%d)", mode); } - return 0.; + // return 0.; } diff --git a/src/oofemlib/gausspoint.h b/src/oofemlib/gausspoint.h index 63bb5c3e1..8dc6311bd 100644 --- a/src/oofemlib/gausspoint.h +++ b/src/oofemlib/gausspoint.h @@ -41,7 +41,7 @@ #ifndef gausspoint_h #define gausspoint_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "integrationrule.h" #include "integrationpointstatus.h" #include "element.h" diff --git a/src/oofemlib/generalboundarycondition.h b/src/oofemlib/generalboundarycondition.h index a92ebcb6c..fb3f99735 100644 --- a/src/oofemlib/generalboundarycondition.h +++ b/src/oofemlib/generalboundarycondition.h @@ -173,6 +173,17 @@ class OOFEM_EXPORT GeneralBoundaryCondition : public FEMComponent /// Performs post initialization steps. virtual void postInitialize() { } + /** + * Returns the value of a property 'aProperty'. Property must be identified + * by unique integer id. + * @param aProperty id of property requested + * @return property value + */ + virtual double giveProperty(int aProperty, TimeStep *tStep) const { + OOFEM_ERROR("Not supported for this boundary condition."); + return 0; + } + // Overloaded methods: void initializeFrom(InputRecord &ir) override; void giveInputRecord(DynamicInputRecord &input) override; diff --git a/src/oofemlib/geometry.C b/src/oofemlib/geometry.C index 704c8f72a..c7ef44ba0 100644 --- a/src/oofemlib/geometry.C +++ b/src/oofemlib/geometry.C @@ -269,10 +269,10 @@ int Line :: computeNumberOfIntersectionPoints(Element *element) const double LineLength = giveLength(); const double absTol = relTol*std::max(LineLength, XfemTolerances::giveCharacteristicElementLength() ); - const int numEdges = element->giveInterpolation()->giveNumberOfEdges(); + const int numEdges = element->giveInterpolation()->giveNumberOfEdges(element->giveGeometryType()); for ( int edgeIndex = 1; edgeIndex <= numEdges; edgeIndex++ ) { - auto bNodes = element->giveInterpolation()->boundaryGiveNodes(edgeIndex); + auto bNodes = element->giveInterpolation()->boundaryGiveNodes(edgeIndex, element->giveGeometryType()); const int nsLoc = bNodes.at(1); const int neLoc = bNodes.at( bNodes.giveSize() ); @@ -805,7 +805,7 @@ Circle :: computeNumberOfIntersectionPoints(Element *element) std :: vector< FloatArray >intersecPoints; this->computeIntersectionPoints(element, intersecPoints); - return intersecPoints.size(); + return (int) intersecPoints.size(); } bool Circle :: isOutside(BasicGeometry *bg) @@ -1267,7 +1267,7 @@ void PolygonLine :: giveInputRecord(DynamicInputRecord &input) input.setRecordKeywordField( "PolygonLine", 1 ); FloatArray points; - int nVert = mVertices.size(); + int nVert = (int) mVertices.size(); points.resize(nVert * 2); for ( int i = 0; i < nVert; i++ ) { @@ -1611,7 +1611,7 @@ PolygonLine :: computeNumberOfIntersectionPoints(Element *element) { std :: vector< FloatArray >intersecPoints; this->computeIntersectionPoints(element, intersecPoints); - return intersecPoints.size(); + return (int) intersecPoints.size(); } bool PolygonLine :: isOutside(BasicGeometry *bg) diff --git a/src/oofemlib/geometry.h b/src/oofemlib/geometry.h index 42c42f522..bb2c38f50 100644 --- a/src/oofemlib/geometry.h +++ b/src/oofemlib/geometry.h @@ -35,7 +35,7 @@ #ifndef geometry_h #define geometry_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "error.h" #include "floatarray.h" #include "inputrecord.h" diff --git a/src/oofemlib/geotoolbox.h b/src/oofemlib/geotoolbox.h index 2ef94078b..1924ce9e5 100644 --- a/src/oofemlib/geotoolbox.h +++ b/src/oofemlib/geotoolbox.h @@ -38,7 +38,7 @@ #include #include -#include "oofemcfg.h" +#include "oofemenv.h" #include "floatarray.h" #ifdef __OOFEG @@ -109,7 +109,7 @@ class OOFEM_EXPORT Polygon Vertex curr; std :: list< Vertex > :: const_iterator iter; public: - PolygonEdgeIterator(const Polygon * p) : iter() { + PolygonEdgeIterator(const Polygon * p) : ptr(NULL), iter() { iter = p->vertices.begin(); if ( iter == p->vertices.end() ) { last = true; diff --git a/src/oofemlib/grid.C b/src/oofemlib/grid.C index 0e13acd1d..daac60bf2 100644 --- a/src/oofemlib/grid.C +++ b/src/oofemlib/grid.C @@ -127,11 +127,11 @@ Grid :: setZeroValues(FloatMatrix *gridCoords) i = m; } // determine the index of the nearest grid node - int CPInd = ij2ind(i, j, m); + int CPInd = ij2ind((int)i, (int)j, (int)m); // Calculate time-distance of nearest grid node and freeze the value - double Fij = F.at(i, j); - T.at(i, j) = sqrt( ( i - CPy ) * ( i - CPy ) + ( j - CPx ) * ( j - CPx ) ) / Fij; + double Fij = F.at((size_t)i, (size_t)j); + T.at((size_t)i, (size_t)j) = sqrt( ( i - CPy ) * ( i - CPy ) + ( j - CPx ) * ( j - CPx ) ) / Fij; Frozen [ CPInd ] = true; // For four direct neighbors or all eight neighbours of the nearest grid node, do the same @@ -139,8 +139,8 @@ Grid :: setZeroValues(FloatMatrix *gridCoords) if ( initDiag <= 0. ) { // initialize direct neighbors only for ( int neigh = 0; neigh < 4; neigh++ ) { - int ni = i + iOffsets [ neigh ]; - int nj = j + jOffsets [ neigh ]; + int ni = (int)(i + iOffsets [ neigh ]); + int nj = (int)(j + jOffsets [ neigh ]); if ( isInDomain(ni, nj, m, n) ) { int nInd = ij2ind(ni, nj, m); double time; @@ -159,8 +159,8 @@ Grid :: setZeroValues(FloatMatrix *gridCoords) } } else { // initialize all neighbors for ( int neigh = 0; neigh < 8; neigh++ ) { - int ni = i + iOffsets_full [ neigh ]; - int nj = j + jOffsets_full [ neigh ]; + int ni = (int) (i + iOffsets_full [ neigh ]); + int nj = (int) (j + jOffsets_full [ neigh ]); if ( isInDomain(ni, nj, m, n) ) { int nInd = ij2ind(ni, nj, m); double time; @@ -275,7 +275,7 @@ Grid :: fastMarch(int &eFlag) // If valid for consideration if ( isInDomain(ni, nj, m, n) && !Frozen [ nInd ] ) { int tmpFlag; - double time = calcTime(ni, nj, F.at(ni, nj), order, tmpFlag); + time = calcTime(ni, nj, F.at(ni, nj), order, tmpFlag); // If T(ni,nj) has not been previously calculated if ( !narrowBand->isInHeap(nInd) ) { narrowBand->insert(time, nInd); @@ -334,7 +334,7 @@ Grid :: calcTime(int i, int j, double Fij, int ord, int &eFlag) if ( ( CrossVals [ 1 ] == Inf ) && ( CrossVals [ 2 ] == Inf ) && ( CrossVals [ 5 ] == Inf ) && ( CrossVals [ 6 ] == Inf ) ) { eFlag = 0; - double time = Inf; + time = Inf; return time; } diff --git a/src/oofemlib/grid.h b/src/oofemlib/grid.h index c0229a360..e2255bd60 100644 --- a/src/oofemlib/grid.h +++ b/src/oofemlib/grid.h @@ -93,10 +93,10 @@ class Grid double calcTime(int i, int j, double Fij, int ord, int &eFlag); /// Utility methods - int ij2ind(int i, int j, int m) { return ( ( i - 1 ) + ( j - 1 ) * m ); } - int ind2i(int ind, int m) { return 1 + ind - ( ind / m ) * m; } - int ind2j(int ind, int m) { return ( ( ind ) / m ) + 1; } - bool isInDomain(int i, int j, int m, int n) { return ( ( i >= 1 ) && ( j >= 1 ) && ( i <= m ) && ( j <= n ) ); } + int ij2ind(int _i, int _j, int _m) { return ( ( _i - 1 ) + ( _j - 1 ) * _m ); } + int ind2i(int ind, int _m) { return 1 + ind - ( ind / _m ) * _m; } + int ind2j(int ind, int _m) { return ( ( ind ) / _m ) + 1; } + bool isInDomain(int i, int j, int _m, int _n) { return ( ( i >= 1 ) && ( j >= 1 ) && ( i <= _m ) && ( j <= _n ) ); } }; } // end namespace oofem #endif // grid_h diff --git a/src/oofemlib/hangingnode.C b/src/oofemlib/hangingnode.C index 4b0062780..981f8c46f 100644 --- a/src/oofemlib/hangingnode.C +++ b/src/oofemlib/hangingnode.C @@ -1,4 +1,4 @@ -/* +/* * * ##### ##### ###### ###### ### ### * ## ## ## ## ## ## ## ### ## @@ -41,6 +41,10 @@ #include "spatiallocalizer.h" #include "classfactory.h" +#include "array" +#include "vector" +#include + namespace oofem { REGISTER_DofManager(HangingNode); @@ -56,6 +60,8 @@ void HangingNode :: initializeFrom(InputRecord &ir) Node :: initializeFrom(ir); this->masterElement = -1; IR_GIVE_OPTIONAL_FIELD(ir, this->masterElement, _IFT_HangingNode_masterElement); + this->masterElementRot = -1; + IR_GIVE_OPTIONAL_FIELD( ir, this->masterElementRot, _IFT_HangingNode_masterElement ); this->masterRegion = 0; IR_GIVE_OPTIONAL_FIELD(ir, this->masterRegion, _IFT_HangingNode_masterRegion); } @@ -90,6 +96,311 @@ int HangingNode :: checkConsistency() } return result; } +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +//2d +std::tuple HangingNode::findMasterNodesWithAlignedCoordinates( const IntArray &masterNodes, FloatArray localLcoords, Element *e ) const +{ + FEInterpolation *fei = e->giveInterpolation(); + FloatArray localLcoords1, localLcoords2; + if ( masterNodes.giveSize() < 2 ) { + OOFEM_ERROR( "Not enough master nodes for interpolation." ); + } + + // Hanging node global coordinates + FloatArray hangingGlobalCoords = this->giveCoordinates(); + double xh = hangingGlobalCoords.at( 1 ); + double yh = hangingGlobalCoords.at( 2 ); + + int node1 = -1, node2 = -1; + bool alignedWithX = false; // True if aligned along x-axis, false if y-axis + + // Identify two master nodes aligned with the hanging node (in global coordinates) + for ( int i = 1; i <= masterNodes.giveSize(); i++ ) { + FloatArray masterCoords = this->domain->giveNode( masterNodes.at( i ) )->giveCoordinates(); + double xm = masterCoords.at( 1 ); + double ym = masterCoords.at( 2 ); + + if ( fabs( xm - xh ) < 1e-12 ) { // Same x-coordinate (aligned vertically) + if ( node1 == -1 ) { + node1 = masterNodes.at( i ); + } else { + node2 = masterNodes.at( i ); + alignedWithX = false; // Aligned along y-direction + break; + } + } else if ( fabs( ym - yh ) < 1e-12 ) { // Same y-coordinate (aligned horizontally) + if ( node1 == -1 ) { + node1 = masterNodes.at( i ); + } else { + node2 = masterNodes.at( i ); + alignedWithX = true; // Aligned along x-direction + break; + } + } + } + + if ( node1 == -1 || node2 == -1 ) { + OOFEM_ERROR( "Could not find two suitable master nodes for interpolation." ); + } + + // Convert master node global coordinates to local (isoparametric) coordinates + FloatArray masterLcoords1, masterLcoords2; + FloatArray masterGlobalCoords1 = this->domain->giveNode( node1 )->giveCoordinates(); + FloatArray masterGlobalCoords2 = this->domain->giveNode( node2 )->giveCoordinates(); + + fei->global2local( localLcoords1, masterGlobalCoords1, FEIElementGeometryWrapper( e ) ); + fei->global2local( localLcoords2, masterGlobalCoords2, FEIElementGeometryWrapper( e ) ); + + //double ksi1 = localLcoords1.at( 1 ); + //double eta1 = localLcoords1.at( 2 ); + //double ksi2 = localLcoords2.at( 1 ); + //double eta2 = localLcoords2.at( 2 ); + + //// Compute dl using local coordinates + //double dl = alignedWithX ? fabs( ksi2 - ksi1 ) : fabs( eta2 - eta1 ); + double dl = alignedWithX ? fabs( masterGlobalCoords1.at( 1 ) - hangingGlobalCoords.at( 1 ) ) : fabs( masterGlobalCoords1.at( 2 ) - hangingGlobalCoords.at( 2 ) ); + //double dl = alignedWithX ? fabs( ksi1 - localLcoords.at( 1 ) ) : fabs( eta1 - localLcoords.at( 2 ) ); + return { node1, node2, dl }; +} + +FloatArray HangingNode::computeMasterContributionForRv( const IntArray &masterNodes, const FloatArray &translationContribution, const FloatArray &lcoords, Element *e ) const +{ + FloatArray localLcoords = lcoords; + // Find master nodes and parametric distance (dl) + auto [masterNode1, masterNode2, dl] = findMasterNodesWithAlignedCoordinates( masterNodes, localLcoords, e ); + + if ( fabs( dl ) < 1e-12 ) { + OOFEM_ERROR( "Division by zero detected in rotation contribution computation." ); + } + + int masterSize = masterNodes.giveSize(); + FloatArray contribution; + contribution.resize( masterSize ); + contribution.zero(); + + // Compute rotation contributions using translation contributions in parametric space + //double theta = (translationContribution.at( masterNode1 ) - translationContribution.at( masterNode2 )) / dl; + //double theta = ( 1.0 - translationContribution.at( masterNode1 ) ) / dl; + //double theta2 = translationContribution.at( masterNode2 ) / dl; + + // Assign contributions to the correct master nodes + for ( int i = 1; i <= masterSize; ++i ) { + if ( masterNodes.at( i ) == masterNode1 ) { + contribution.at( i ) = ( 1.0 - translationContribution.at( i ) ) / dl; + //contribution.at( i ) = theta; // Contribution from masterNode1 + } else if ( masterNodes.at( i ) == masterNode2 ) { + //contribution.at( i ) = -( 1.0 - translationContribution.at( i ) ) / dl; + //contribution.at( i ) = -theta; // Contribution from masterNode2 + contribution.at( i ) = - translationContribution.at( i ) / dl; + } else { + contribution.at( i ) = 0.0; // No contribution from other nodes + } + } + + return contribution; +} +///////////////////////////////////////////////////////////////////////////////////////// +// 3d +// Compute the Euclidean distance between two 3D points +double HangingNode::computeDistance( const FloatArray &masterGlobalCoords1, const FloatArray &masterGlobalCoords2 ) +{ + //FloatArray masterGlobalCoords1 = n1.giveCoordinates(); + //FloatArray masterGlobalCoords2 = n2.giveCoordinates(); + return std::sqrt( std::pow( masterGlobalCoords1.at( 1 ) - masterGlobalCoords2.at( 1 ), 2 ) + std::pow( masterGlobalCoords1.at( 2 ) - masterGlobalCoords2.at( 2 ), 2 ) + std::pow( masterGlobalCoords1.at( 3 ) - masterGlobalCoords2.at( 3 ), 2 ) ); +} + +double HangingNode::distance( const std::array &a, const std::array &b ) +{ + return std::sqrt( std::pow( b[0] - a[0], 2 ) + std::pow( b[1] - a[1], 2 ) + std::pow( b[2] - a[2], 2 ) ); +} + +int HangingNode::findNormalDirection(const FloatArray& localLcoords1, const FloatArray& localLcoords2, const FloatArray& localLcoords3) { + // Tolerance to handle floating-point precision + const double EPSILON = 1e-6; + + // Check if all three points have the same zeta (ζ) coordinate + if ( std::fabs( localLcoords1[2] - localLcoords2[2] ) < EPSILON && std::fabs( localLcoords2[2] - localLcoords3[2] ) < EPSILON ) { + return 2; // Normal along ζ → Points lie in ξ-η plane + } + + // Check if all three points have the same eta (η) coordinate + if ( std::fabs( localLcoords1[1] - localLcoords2[1] ) < EPSILON && std::fabs( localLcoords2[1] - localLcoords3[1] ) < EPSILON ) { + return 1; // Normal along η → Points lie in ξ-ζ plane + } + + // Check if all three points have the same ksi (ξ) coordinate + if ( std::fabs( localLcoords1[0] - localLcoords2[0] ) < EPSILON && std::fabs( localLcoords2[0] - localLcoords3[0] ) < EPSILON ) { + return 0; // Normal along ξ → Points lie in η-ζ plane + } + + return -1; // Not aligned in a single coordinate plane +} + + +// Function to find the three closest nodes to a hanging node +std::vector HangingNode::findThreeClosestNodes( FloatArray &hangingNodeCoords, const IntArray &hexaNodes ) +{ + std::vector > distances; + std::array hangCoords = { hangingNodeCoords.at( 1 ), hangingNodeCoords.at( 2 ), hangingNodeCoords.at( 3 ) }; + // Compute distances and store index positions + for ( size_t i = 0; i < hexaNodes.size(); ++i ) { + const auto &masternode = hexaNodes[i]; + FloatArray masterGlobalCoords = this->domain->giveNode( masternode )->giveCoordinates(); + //masternode.giveCoordinates(); + // Convert FloatArray to std::array if needed + std::array masterCoords = { masterGlobalCoords.at( 1 ), masterGlobalCoords.at( 2 ), masterGlobalCoords.at( 3 ) }; + double dist = distance( hangCoords, masterCoords ); + distances.emplace_back( dist, i ); // Store distance and index + } + + // Find the 3 smallest distances using nth_element + if ( distances.size() < 3 ) { + throw std::runtime_error( "Not enough nodes to find three closest ones." ); + } + + std::nth_element( distances.begin(), distances.begin() + 3, distances.end() ); + + // Return the indices of the three closest nodes + return { distances[0].second, distances[1].second, distances[2].second }; +} + +//// Function to create the transformation matrix of the master triangle +//double [3][3] createTransformationTABC( const std::vector &coords ) +//{ +// double x1 = coords[0], y1 = coords[1], z1 = coords[2]; +// double x2 = coords[3], y2 = coords[4], z2 = coords[5]; +// double exx = coords[6], exy = coords[7], exz = coords[8]; +// +// double elemLength = std::sqrt( std::pow( x2 - x1, 2 ) + std::pow( y2 - y1, 2 ) + std::pow( z2 - z1, 2 ) ); +// +// double L1 = ( x2 - x1 ) / elemLength; +// double L2 = ( y2 - y1 ) / elemLength; +// double L3 = ( z2 - z1 ) / elemLength; +// +// double DXM = exy * ( z2 - z1 ) - exz * ( y2 - y1 ); +// double DYM = -exx * ( z2 - z1 ) + exz * ( x2 - x1 ); +// double DZM = exx * ( y2 - y1 ) - exy * ( x2 - x1 ); +// double DM = std::sqrt( DXM * DXM + DYM * DYM + DZM * DZM ); +// +// double M1 = ( exx != 0 ) ? exx / std::abs( exx ) : 0; +// double M2 = ( exy != 0 ) ? exy / std::abs( exy ) : 0; +// double M3 = ( exz != 0 ) ? exz / std::abs( exz ) : 0; +// +// double N1 = (DM != 0) ? DXM / DM : 0; +// double N2 = ( DM != 0 ) ? DYM / DM : 0 ; +// double N3 = ( DM != 0 ) ? DZM / DM : 0 ; +// +// double +// +// TABC[0][0] = L1; +// TABC[0][1] = L2; +// TABC[0][2] = L3; +// TABC[1][0] = M1; +// TABC[1][1] = M2; +// TABC[1][2] = M3; +// TABC[2][0] = N1; +// TABC[2][1] = N2; +// TABC[2][2] = N3; // Placeholder for N values if needed +//} + +FloatArray HangingNode::computeTriangleRotations( DofIDItem id, FloatArray &hangingNodeCoords, const IntArray &hexaNodes, const FloatArray &translationContribution, Element *e ) +{ + int numCols = hexaNodes.giveSize(); // Assuming T has 9 columns, adjust if needed + FloatArray localLcoords1, localLcoords2, localLcoords3, globalLcoords1, globalLcoords2, globalLcoords3; + FEInterpolation *fei = e->giveInterpolation(); + + // Find the three closest nodes to the hanging node + std::vector nodeSurface = findThreeClosestNodes( hangingNodeCoords, hexaNodes ); + + // Extract the triangle nodes based on the closest nodes + FloatArray masterGlobalCoords1 = this->domain->giveNode( hexaNodes[nodeSurface[0]] )->giveCoordinates(); + FloatArray masterGlobalCoords2 = this->domain->giveNode( hexaNodes[nodeSurface[1]] )->giveCoordinates(); + FloatArray masterGlobalCoords3 = this->domain->giveNode( hexaNodes[nodeSurface[2]] )->giveCoordinates(); + + // Compute the edge lengths + double La1 = computeDistance( masterGlobalCoords1, masterGlobalCoords2 ); + double Lb1 = computeDistance( masterGlobalCoords2, masterGlobalCoords3 ); + double Lc1 = computeDistance( masterGlobalCoords1, masterGlobalCoords3 ); + double S1 = ( La1 + Lb1 + Lc1 ) / 2.0; + double Omega1 = std::sqrt( S1 * ( S1 - La1 ) * ( S1 - Lb1 ) * ( S1 - Lc1 ) ); + + //std::array Array_Axes = { 0, 1, 2, 0, 1, 2 }; + fei->global2local( localLcoords1, masterGlobalCoords1, FEIElementGeometryWrapper( e ) ); + fei->global2local( localLcoords2, masterGlobalCoords2, FEIElementGeometryWrapper( e ) ); + fei->global2local( localLcoords3, masterGlobalCoords3, FEIElementGeometryWrapper( e ) ); + + int normal_dir = findNormalDirection( localLcoords1, localLcoords2, localLcoords3 ); + // FloatArray A = { localLcoords1[Array_Axes[normal_dir]], localLcoords1[Array_Axes[normal_dir+1]], localLcoords1[Array_Axes[normal_dir+2]] }; + // FloatArray B = { localLcoords2[Array_Axes[normal_dir]], localLcoords2[Array_Axes[normal_dir+1]], localLcoords2[Array_Axes[normal_dir+2]] }; + // FloatArray C = { localLcoords3[Array_Axes[normal_dir]], localLcoords3[Array_Axes[normal_dir+1]], localLcoords3[Array_Axes[normal_dir+2]] }; + + ///* FloatArray A = { Local_X1[0], Local_Y1[0], Local_Z1[0] }; + // FloatArray B = { Local_X1[1], Local_Y1[1], Local_Z1[1] }; + // FloatArray C = { Local_X1[2], Local_Y1[2], Local_Z1[2] };*/ + // fei->local2global( globalLcoords1, A, FEIElementGeometryWrapper( e ) ); + // fei->local2global( globalLcoords2, B, FEIElementGeometryWrapper( e ) ); + // fei->local2global( globalLcoords3, C, FEIElementGeometryWrapper( e ) ); + std::array X1 = { masterGlobalCoords3[0] - masterGlobalCoords2[0], masterGlobalCoords1[0] - masterGlobalCoords3[0], masterGlobalCoords2[0] - masterGlobalCoords1[0] }; + std::array Y1 = { masterGlobalCoords3[1] - masterGlobalCoords2[1], masterGlobalCoords1[1] - masterGlobalCoords3[1], masterGlobalCoords2[1] - masterGlobalCoords1[1] }; + std::array Z1 = { masterGlobalCoords3[2] - masterGlobalCoords2[2], masterGlobalCoords1[2] - masterGlobalCoords3[2], masterGlobalCoords2[2] - masterGlobalCoords1[2] }; + + std::array Array_NodesContr = { nodeSurface[0], nodeSurface[1], nodeSurface[2], nodeSurface[0], nodeSurface[1], nodeSurface[2] }; + FloatArray T(numCols); + if ( !std::isnan( Omega1 ) && Omega1 != 0 ) { + for ( int i = 0; i < 3; i++ ) { + if ( normal_dir == 0 ) // Normal in ksi (y) -> Plane is eta-zeta (x-z) + { + if ( id == R_w ) { + T.at( hexaNodes[Array_NodesContr[i]] ) += X1[i] / ( 2.0 * Omega1 ) * ( 1.0 - translationContribution.at( hexaNodes[Array_NodesContr[i]] ) ); + T.at( hexaNodes[Array_NodesContr[i+1]] ) += X1[i] / ( 2.0 * Omega1 ) * ( - translationContribution.at( hexaNodes[Array_NodesContr[i+1]] ) ); + T.at( hexaNodes[Array_NodesContr[i + 2]] ) += X1[i] / ( 2.0 * Omega1 ) * ( -translationContribution.at( hexaNodes[Array_NodesContr[i + 2]] ) ); + } else if ( id == R_v ) { + T.at( hexaNodes[Array_NodesContr[i]] ) += Z1[i] / ( 2.0 * Omega1 ) * ( 1.0 - translationContribution.at( hexaNodes[Array_NodesContr[i]] ) ); + T.at( hexaNodes[Array_NodesContr[i+1]] ) += Z1[i] / ( 2.0 * Omega1 ) * ( - translationContribution.at( hexaNodes[Array_NodesContr[i+1]] ) ); + T.at( hexaNodes[Array_NodesContr[i + 2]] ) += Z1[i] / ( 2.0 * Omega1 ) * ( -translationContribution.at( hexaNodes[Array_NodesContr[i + 2]] ) ); + } else if ( id == R_u ) { + T.at( hexaNodes[Array_NodesContr[i]] ) += ( - Z1[i] / ( 2.0 * Omega1 ) - X1[i] / ( 2.0 * Omega1 )) * ( 1.0 - translationContribution.at( hexaNodes[Array_NodesContr[i]] ) ); + T.at( hexaNodes[Array_NodesContr[i+1]] ) += ( -Z1[i] / ( 2.0 * Omega1 ) - X1[i] / ( 2.0 * Omega1 ) ) * ( - translationContribution.at( hexaNodes[Array_NodesContr[i+1]] ) ); + T.at( hexaNodes[Array_NodesContr[i+2]] ) += ( -Z1[i] / ( 2.0 * Omega1 ) - X1[i] / ( 2.0 * Omega1 ) ) * ( - translationContribution.at( hexaNodes[Array_NodesContr[i+2]] ) ); + } + } else if ( normal_dir == 1 ) // Normal in eta (x) -> Plane is ksi-zeta (y-z) + { + if ( id == R_w ) { + T.at( hexaNodes[Array_NodesContr[i]] ) += Z1[i] / ( 2.0 * Omega1 ) * ( 1.0 - translationContribution.at( hexaNodes[Array_NodesContr[i]] ) ); + T.at( hexaNodes[Array_NodesContr[i + 1]] ) += Z1[i] / ( 2.0 * Omega1 ) * ( -translationContribution.at( hexaNodes[Array_NodesContr[i + 1]] ) ); + T.at( hexaNodes[Array_NodesContr[i + 2]] ) += Z1[i] / ( 2.0 * Omega1 ) * ( -translationContribution.at( hexaNodes[Array_NodesContr[i + 2]] ) ); + } else if ( id == R_v ) { + T.at( hexaNodes[Array_NodesContr[i]] ) += Y1[i] / ( 2.0 * Omega1 ) * ( 1.0 - translationContribution.at( hexaNodes[Array_NodesContr[i]] ) ); + T.at( hexaNodes[Array_NodesContr[i+1]] ) += Y1[i] / ( 2.0 * Omega1 ) * ( - translationContribution.at( hexaNodes[Array_NodesContr[i+1]] ) ); + T.at( hexaNodes[Array_NodesContr[i + 2]] ) += Y1[i] / ( 2.0 * Omega1 ) * ( -translationContribution.at( hexaNodes[Array_NodesContr[i + 2]] ) ); + } else if ( id == R_u ) { + T.at( hexaNodes[Array_NodesContr[i]] ) = ( -Z1[i] / ( 2.0 * Omega1 ) - Y1[i] / ( 2.0 * Omega1 ) ) * ( 1.0 - translationContribution.at( hexaNodes[Array_NodesContr[i]] ) ); + T.at( hexaNodes[Array_NodesContr[i+1]] ) = ( -Z1[i] / ( 2.0 * Omega1 ) - Y1[i] / ( 2.0 * Omega1 ) ) * ( - translationContribution.at( hexaNodes[Array_NodesContr[i+1]] ) ); + T.at( hexaNodes[Array_NodesContr[i + 2]] ) = ( -Z1[i] / ( 2.0 * Omega1 ) - Y1[i] / ( 2.0 * Omega1 ) ) * ( -translationContribution.at( hexaNodes[Array_NodesContr[i + 2]] ) ); + } + } else if ( normal_dir == 2 ) // Normal in zeta (z) -> Plane is ksi-eta (y-x) + { + if ( id == R_w ) { + T.at( hexaNodes[Array_NodesContr[i]] ) += Y1[i] / ( 2.0 * Omega1 ) * ( 1.0 - translationContribution.at( hexaNodes[Array_NodesContr[i]] ) ); + T.at( hexaNodes[Array_NodesContr[i + 1]] ) += Y1[i] / ( 2.0 * Omega1 ) * ( -translationContribution.at( hexaNodes[Array_NodesContr[i + 1]] ) ); + T.at( hexaNodes[Array_NodesContr[i + 2]] ) += Y1[i] / ( 2.0 * Omega1 ) * ( -translationContribution.at( hexaNodes[Array_NodesContr[i + 2]] ) ); + } else if ( id == R_v ) { + T.at( hexaNodes[Array_NodesContr[i]] ) += X1[i] / ( 2.0 * Omega1 ) * ( 1.0 - translationContribution.at( hexaNodes[Array_NodesContr[i]] ) ); + T.at( hexaNodes[Array_NodesContr[i + 1]] ) += X1[i] / ( 2.0 * Omega1 ) * ( -translationContribution.at( hexaNodes[Array_NodesContr[i + 1]] ) ); + T.at( hexaNodes[Array_NodesContr[i + 2]] ) += X1[i] / ( 2.0 * Omega1 ) * ( -translationContribution.at( hexaNodes[Array_NodesContr[i + 2]] ) ); + } else if ( id == R_u ) { + T.at( hexaNodes[Array_NodesContr[i]] ) = ( -X1[i] / ( 2.0 * Omega1 ) - Y1[i] / ( 2.0 * Omega1 ) ) * ( 1.0 - translationContribution.at( hexaNodes[Array_NodesContr[i]] ) ); + T.at( hexaNodes[Array_NodesContr[i+1]] ) = ( -X1[i] / ( 2.0 * Omega1 ) - Y1[i] / ( 2.0 * Omega1 ) ) * ( 1.0 - translationContribution.at( hexaNodes[Array_NodesContr[i+1]] ) ); + T.at( hexaNodes[Array_NodesContr[i+2]] ) = ( -X1[i] / ( 2.0 * Omega1 ) - Y1[i] / ( 2.0 * Omega1 ) ) * ( 1.0 - translationContribution.at( hexaNodes[Array_NodesContr[i+2]] ) ); + } + } + } + } + //multiplyMatrices( TABC1.transpose(), T.block( 3, 0, 3, 3 ) ); + //multiplyMatrices( T.block( 3, 0, 3, 3 ), TABC1 ); + return T; +} + void HangingNode :: postInitialize() { @@ -98,6 +409,7 @@ void HangingNode :: postInitialize() Element *e; FEInterpolation *fei; FloatArray lcoords, masterContribution; + FloatArray globalCoords1, globalCoords3; // Store global coordinates of master nodes #ifdef __OOFEG if ( initialized ) { @@ -137,10 +449,10 @@ void HangingNode :: postInitialize() SlaveDof *sdof = dynamic_cast< SlaveDof * >(dof); if ( sdof ) { DofIDItem id = sdof->giveDofID(); - fei = e->giveInterpolation(id); + fei = e->giveInterpolation( id ); if ( !fei ) { - OOFEM_ERROR("Requested interpolation for dof id %d doesn't exist in element %d.", - id, this->masterElement); + OOFEM_ERROR( "Requested interpolation for dof id %d doesn't exist in element %d.", + id, this->masterElement ); } #if 0 // This won't work (yet), as it requires some more general FEI classes, or something similar. if ( fei->hasMultiField() ) { @@ -160,9 +472,24 @@ void HangingNode :: postInitialize() // FEI classes are based on that the first nodes correspond to the simpler/linear interpolation. // If this assumption is changed in FEIElementGeometryWrapper + friends, // masterNode will also need to be modified for each dof accordingly. - fei->evalN( masterContribution, lcoords, FEIElementGeometryWrapper(e) ); - sdof->initialize(masterNodes, IntArray(), masterContribution); + fei->evalN( masterContribution, lcoords, FEIElementGeometryWrapper( e ) ); + // Special handling for RV + if ( (id == R_v || id == R_w || id == R_u) && (this->domain-> giveDomainType() == _3dMode)) { + // Compute master contributions for Rv + FloatArray translationContribution = masterContribution; + /*masterContribution = this->computeMasterContributionForRv( masterNodes, translationContribution, lcoords, e );*/ + masterContribution = this->computeTriangleRotations( id, coordinates, masterNodes, translationContribution, e ); + } else if ( ( id == R_v || id == R_w || id == R_u ) && ( this->domain->giveDomainType() == _2dPlaneStressMode || this->domain->giveDomainType() == _PlaneStrainMode ) ) { + // Compute master contributions for Rv + FloatArray translationContribution = masterContribution; + masterContribution = this->computeMasterContributionForRv( masterNodes, translationContribution, lcoords, e ); + } + sdof->initialize( masterNodes, IntArray(), masterContribution ); #endif + /* } else if ( (dof->giveDofID() == R_v) && (masterElementRot > 0) ) { + fei->evalN( masterContribution, lcoords, FEIElementGeometryWrapper( e ) ); + FloatArray translationContribution = masterContribution; + masterContribution = this->computeMasterContributionForRv( masterNodes, translationContribution, lcoords, e ); */ } } } diff --git a/src/oofemlib/hangingnode.h b/src/oofemlib/hangingnode.h index 2121c1ad9..3075110a1 100644 --- a/src/oofemlib/hangingnode.h +++ b/src/oofemlib/hangingnode.h @@ -36,11 +36,12 @@ #define hangingnode_h #include "node.h" - +#include "element.h" ///@name Input fields for HangingNode //@{ #define _IFT_HangingNode_Name "hangingnode" #define _IFT_HangingNode_masterElement "masterelement" +//#define _IFT_HangingNode_masterElement "masterelementrot" #define _IFT_HangingNode_masterRegion "masterregion" //@} @@ -66,6 +67,7 @@ class OOFEM_EXPORT HangingNode : public Node protected: /// Number of the master element. int masterElement; + int masterElementRot; /// Region of the master element (used for automatic detection). int masterRegion; #ifdef __OOFEG @@ -83,9 +85,16 @@ class OOFEM_EXPORT HangingNode : public Node /// Destructor. virtual ~HangingNode(void) { } - void initializeFrom(InputRecord &ir) override; + void initializeFrom(InputRecord &ir) override; + FloatArray computeTriangleRotations( DofIDItem id, FloatArray &hangingNodeCoords, const IntArray &hexaNodes, const FloatArray &translationContribution, Element *e ); void postInitialize() override; int checkConsistency() override; + std::tuple findMasterNodesWithAlignedCoordinates( const IntArray &masterNodes, FloatArray localLcoords, Element *e ) const; + FloatArray computeMasterContributionForRv( const IntArray &masterNodes, const FloatArray &translationContribution, const FloatArray &lcoords, Element *e ) const; + static double computeDistance( const FloatArray &masterGlobalCoords1, const FloatArray &masterGlobalCoords2 ); + static double distance( const std::array &a, const std::array &b ); + std::vector findThreeClosestNodes( FloatArray &hangingNodeCoords, const IntArray &hexaNodes ); + int findNormalDirection( const FloatArray &localLcoords1, const FloatArray &localLcoords2, const FloatArray &localLcoords3 ); bool isDofTypeCompatible(dofType type) const override { return ( type == DT_master || type == DT_slave ); } const char *giveClassName() const override { return "HangingNode"; } diff --git a/src/oofemlib/heap.C b/src/oofemlib/heap.C index 403e21c66..bde276301 100644 --- a/src/oofemlib/heap.C +++ b/src/oofemlib/heap.C @@ -232,8 +232,8 @@ void Heap :: recurse(int row, int pad, int spacing, int S) { } // Calculate the first and last elements on the row - int beg = ( pow( 2, ( row - 1 ) ) - 1 ); - int end = MIN( ( heapCount - 1 ), ( pow(2, row) - 2 ) ); + int beg = (int) ( pow( 2, ( row - 1 ) ) - 1 ); + int end = (int) MIN( ( heapCount - 1 ), ( pow(2, row) - 2 ) ); // Newline and padding printf("\n"); @@ -256,7 +256,7 @@ void Heap :: printTree() { int S = 3; int B = 4; - int nRows = 1 + floor( log2(heapCount) ); + int nRows = (int) (1 + floor( log2(heapCount) )); // Call recurse from the last row printf("\n"); diff --git a/src/oofemlib/homogenize.C b/src/oofemlib/homogenize.C index e89a6002f..c290721da 100644 --- a/src/oofemlib/homogenize.C +++ b/src/oofemlib/homogenize.C @@ -43,7 +43,7 @@ Homogenize :: Homogenize() void Homogenize :: voigt(FloatMatrix &PhaseMatrix) { double k, mu; - double volTot = 0.; + //double volTot = 0.; int NumPhases = PhaseMatrix.giveNumberOfRows(); checkVolFraction(PhaseMatrix); @@ -54,7 +54,7 @@ void Homogenize :: voigt(FloatMatrix &PhaseMatrix) ENuToKMu(PhaseMatrix(r, 1), PhaseMatrix(r, 2), k, mu); k_hmg += k * PhaseMatrix(r, 0); mu_hmg += mu * PhaseMatrix(r, 0); - volTot += PhaseMatrix(r, 0); + //volTot += PhaseMatrix(r, 0); } kMuToENu(k_hmg, mu_hmg, E_hmg, nu_hmg); @@ -175,7 +175,7 @@ void Homogenize :: moriTanaka(FloatMatrix &PhaseMatrix, int refRow) { double f_r, E_r, nu_r, k_r, mu_r; double E_m, nu_m, k_m, mu_m; - double fr_tot = 0.; + //double fr_tot = 0.; double nom_k_MT = 0., denom_k_MT = 0., nom_mu_MT = 0., denom_mu_MT = 0.; double k_S_denom = 0., mu_S_denom = 0.; double alpha_m, beta_m; @@ -200,7 +200,7 @@ void Homogenize :: moriTanaka(FloatMatrix &PhaseMatrix, int refRow) E_r = PhaseMatrix(r, 1); nu_r = PhaseMatrix(r, 2); - fr_tot += f_r; + //fr_tot += f_r; ENuToKMu(E_r, nu_r, k_r, mu_r); nom_k_MT += f_r * k_r / ( 1. + alpha_m * ( k_r / k_m - 1. ) ); @@ -244,7 +244,7 @@ void Homogenize :: selfConsistent(FloatMatrix &PhaseMatrix) { double f_r, E_r, nu_r, k_r, mu_r; double k_SCS, mu_SCS, nom_k_SCS, denom_k_SCS, nom_mu_SCS, denom_mu_SCS; - double fr_tot; + //double fr_tot; double alpha_m = 0., beta_m = 0.; double k_S_denom = 0., mu_S_denom = 0.; int numRows = PhaseMatrix.giveNumberOfRows(); @@ -258,7 +258,7 @@ void Homogenize :: selfConsistent(FloatMatrix &PhaseMatrix) /*iteration for nonlinear equations*/ for ( int i = 1; i < 100; i++ ) { - fr_tot = 0.; + //fr_tot = 0.; nom_k_SCS = 0; denom_k_SCS = 0; nom_mu_SCS = 0; @@ -268,7 +268,7 @@ void Homogenize :: selfConsistent(FloatMatrix &PhaseMatrix) E_r = PhaseMatrix(r, 1); nu_r = PhaseMatrix(r, 2); - fr_tot += f_r; + //fr_tot += f_r; ENuToKMu(E_r, nu_r, k_r, mu_r); diff --git a/src/oofemlib/homogenize.h b/src/oofemlib/homogenize.h index cf58114ad..d0bb5e99d 100644 --- a/src/oofemlib/homogenize.h +++ b/src/oofemlib/homogenize.h @@ -35,7 +35,7 @@ #ifndef homogenize_h #define homogenize_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "floatarray.h" #include "floatmatrix.h" #include "error.h" diff --git a/src/oofemlib/iga/feibspline.h b/src/oofemlib/iga/feibspline.h index 8c040c436..2b7bef204 100644 --- a/src/oofemlib/iga/feibspline.h +++ b/src/oofemlib/iga/feibspline.h @@ -84,7 +84,7 @@ class OOFEM_EXPORT BSplineInterpolation : public FEInterpolation nsd(nsd) {} - integrationDomain giveIntegrationDomain() const override { + integrationDomain giveIntegrationDomain(const Element_Geometry_Type egt) const override { if ( nsd == 3 ) { return _Cube; } else if ( nsd == 2 ) { @@ -95,9 +95,9 @@ class OOFEM_EXPORT BSplineInterpolation : public FEInterpolation return _UnknownIntegrationDomain; } } - Element_Geometry_Type giveGeometryType() const override { return EGT_unknown; } + const Element_Geometry_Type giveGeometryType() const override { return EGT_unknown; } - integrationDomain giveBoundaryIntegrationDomain(int ib) const override { + integrationDomain giveBoundaryIntegrationDomain(int ib, const Element_Geometry_Type) const override { if ( nsd == 3 ) { return _Square; } else if ( nsd == 2 ) { @@ -108,7 +108,7 @@ class OOFEM_EXPORT BSplineInterpolation : public FEInterpolation return _UnknownIntegrationDomain; } } - integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf) const override { + integrationDomain giveBoundarySurfaceIntegrationDomain(int isurf, const Element_Geometry_Type) const override { if ( nsd == 3 ) { return _Square; } else if ( nsd == 2 ) { @@ -117,7 +117,7 @@ class OOFEM_EXPORT BSplineInterpolation : public FEInterpolation return _UnknownIntegrationDomain; } } - integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge) const override { + integrationDomain giveBoundaryEdgeIntegrationDomain(int iedge, const Element_Geometry_Type) const override { if ( nsd >= 2 ) { return _Line; } else { @@ -125,15 +125,15 @@ class OOFEM_EXPORT BSplineInterpolation : public FEInterpolation } } - int giveNsd() const override { return nsd; } + int giveNsd(const Element_Geometry_Type) const override { return nsd; } void initializeFrom(InputRecord &ir) override; - IntArray boundaryEdgeGiveNodes(int boundary) const override - { OOFEM_ERROR("Functions not supported for this interpolator."); return {}; } + IntArray boundaryEdgeGiveNodes(int boundary, const Element_Geometry_Type) const override + { OOFEM_ERROR("Functions not supported for this interpolator.");} void boundaryEdgeEvalN(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override { OOFEM_ERROR("Functions not supported for this interpolator."); } double boundaryEdgeGiveTransformationJacobian(int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override - { OOFEM_ERROR("Functions not supported for this interpolator."); return 0.; } + { OOFEM_ERROR("Functions not supported for this interpolator.");} void boundaryEdgeLocal2Global(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override { OOFEM_ERROR("Functions not supported for this interpolator."); } double boundaryEdgeEvalNormal(FloatArray &answer, int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override @@ -152,19 +152,19 @@ class OOFEM_EXPORT BSplineInterpolation : public FEInterpolation { OOFEM_ERROR("Functions not supported for this interpolator."); } double boundarySurfaceGiveTransformationJacobian(int isurf, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override { OOFEM_ERROR("Functions not supported for this interpolator."); } - IntArray boundarySurfaceGiveNodes(int boundary) const override - { OOFEM_ERROR("Functions not supported for this interpolator."); return {}; } + IntArray boundarySurfaceGiveNodes(int boundary, const Element_Geometry_Type) const override + { OOFEM_ERROR("Functions not supported for this interpolator.");} //@} - IntArray boundaryGiveNodes(int boundary) const override - { OOFEM_ERROR("Not implemented"); return {}; } + IntArray boundaryGiveNodes(int boundary, const Element_Geometry_Type) const override + { OOFEM_ERROR("Not implemented"); } void boundaryEvalN(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override { OOFEM_ERROR("Not implemented"); } double boundaryEvalNormal(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override - { OOFEM_ERROR("Not implemented"); return 0.; } + { OOFEM_ERROR("Not implemented"); } double boundaryGiveTransformationJacobian(int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override - { OOFEM_ERROR("boundaryGiveTransformationJacobian - Not implemented"); return 0.; } + { OOFEM_ERROR("boundaryGiveTransformationJacobian - Not implemented"); } void boundaryLocal2Global(FloatArray &answer, int boundary, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override { OOFEM_ERROR("boundaryLocal2Global - Not implemented"); } @@ -181,7 +181,6 @@ class OOFEM_EXPORT BSplineInterpolation : public FEInterpolation void local2global(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; int global2local(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override { OOFEM_ERROR("Not yet implemented."); - return 0; } void giveJacobianMatrixAt(FloatMatrix &jacobianMatrix, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; int giveKnotSpanBasisFuncMask(const IntArray &knotSpan, IntArray &mask) const override; @@ -190,12 +189,12 @@ class OOFEM_EXPORT BSplineInterpolation : public FEInterpolation const char *giveClassName() const { return "BSplineInterpolation"; } bool hasSubPatchFormulation() const override { return true; } - std::unique_ptr giveIntegrationRule(int order) const override - { OOFEM_ERROR("Not supported."); return nullptr; } - std::unique_ptr giveBoundaryIntegrationRule(int order, int boundary) const override - { OOFEM_ERROR("Not supported."); return nullptr; } - std::unique_ptr giveBoundaryEdgeIntegrationRule(int order, int boundary) const override - { OOFEM_ERROR("Not supported."); return nullptr; } + std::unique_ptr giveIntegrationRule(int order, const Element_Geometry_Type) const override + { OOFEM_ERROR("Not supported."); } + std::unique_ptr giveBoundaryIntegrationRule(int order, int boundary, Element_Geometry_Type) const override + { OOFEM_ERROR("Not supported."); } + std::unique_ptr giveBoundaryEdgeIntegrationRule(int order, int boundary, Element_Geometry_Type) const override + { OOFEM_ERROR("Not supported."); } protected: /** diff --git a/src/oofemlib/iga/feinurbs.h b/src/oofemlib/iga/feinurbs.h index ca9fa1daf..8e349dd3f 100644 --- a/src/oofemlib/iga/feinurbs.h +++ b/src/oofemlib/iga/feinurbs.h @@ -64,7 +64,6 @@ class OOFEM_EXPORT NURBSInterpolation : public BSplineInterpolation void local2global(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; int global2local(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override { OOFEM_ERROR("Not yet implemented."); - return 0; } void giveJacobianMatrixAt(FloatMatrix &jacobianMatrix, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; diff --git a/src/oofemlib/iga/feitspline.h b/src/oofemlib/iga/feitspline.h index 2435795a5..6ab815b2f 100644 --- a/src/oofemlib/iga/feitspline.h +++ b/src/oofemlib/iga/feitspline.h @@ -80,7 +80,6 @@ class OOFEM_EXPORT TSplineInterpolation : public BSplineInterpolation void local2global(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; int global2local(FloatArray &answer, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override { OOFEM_ERROR("Not yet implemented, contact lazy dr for implementation"); - return 0; } void giveJacobianMatrixAt(FloatMatrix &jacobianMatrix, const FloatArray &lcoords, const FEICellGeometry &cellgeo) const override; diff --git a/src/oofemlib/iga/iga.C b/src/oofemlib/iga/iga.C index bd6399d2b..37650b25e 100644 --- a/src/oofemlib/iga/iga.C +++ b/src/oofemlib/iga/iga.C @@ -52,7 +52,7 @@ void IGAElement :: initializeFrom(InputRecord &ir) { int indx = 0; numberOfGaussPoints = 1; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE int numberOfKnotSpans = 0; #endif @@ -63,13 +63,13 @@ void IGAElement :: initializeFrom(InputRecord &ir) this->giveInterpolation()->initializeFrom(ir); // read geometry // generate individual IntegrationElements; one for each nonzero knot span - int nsd = this->giveNsd(); + int nsd = this->giveNsd(this->giveGeometryType()); if ( nsd == 1 ) { //HUHU } else if ( nsd == 2 ) { int numberOfKnotSpansU = this->giveInterpolation()->giveNumberOfKnotSpans(1); int numberOfKnotSpansV = this->giveInterpolation()->giveNumberOfKnotSpans(2); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE numberOfKnotSpans = numberOfKnotSpansU * numberOfKnotSpansV; #endif const IntArray *knotMultiplicityU = this->giveInterpolation()->giveKnotMultiplicity(1); @@ -113,7 +113,7 @@ void IGAElement :: initializeFrom(InputRecord &ir) int numberOfKnotSpansU = this->giveInterpolation()->giveNumberOfKnotSpans(1); int numberOfKnotSpansV = this->giveInterpolation()->giveNumberOfKnotSpans(2); int numberOfKnotSpansW = this->giveInterpolation()->giveNumberOfKnotSpans(3); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE numberOfKnotSpans = numberOfKnotSpansU * numberOfKnotSpansV * numberOfKnotSpansW; #endif const IntArray *knotMultiplicityU = this->giveInterpolation()->giveKnotMultiplicity(1); @@ -166,7 +166,7 @@ void IGAElement :: initializeFrom(InputRecord &ir) throw ValueInputException(ir, "Domain", "unsupported number of spatial dimensions"); } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE // read optional knot span parallel mode this->knotSpanParallelMode.resize(numberOfKnotSpans); // set Element_local as default @@ -178,7 +178,7 @@ void IGAElement :: initializeFrom(InputRecord &ir) } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE elementParallelMode IGAElement :: giveKnotSpanParallelMode(int knotSpanIndex) const { @@ -194,7 +194,7 @@ IGAElement :: giveKnotSpanParallelMode(int knotSpanIndex) const return Element_local; //to make compiler happy } -#endif // __PARALLEL_MODE +#endif // __MPI_PARALLEL_MODE // integration elements are setup in the same way as for IGAElement for now HUHU @@ -215,7 +215,7 @@ void IGATSplineElement :: initializeFrom(InputRecord &ir) // generate individual IntegrationElements; one for each nonzero knot span - int nsd = giveNsd(); + int nsd = giveNsd(this->giveGeometryType()); if ( nsd == 2 ) { int numberOfKnotSpansU = this->giveInterpolation()->giveNumberOfKnotSpans(1); int numberOfKnotSpansV = this->giveInterpolation()->giveNumberOfKnotSpans(2); @@ -304,7 +304,7 @@ void IGAElement :: drawRawGeometry(oofegGraphicContext &gc, TimeStep *tStep) #endif const FloatArray *knotVector = interp->giveKnotVector(); - int nsd = this->giveNsd(); + int nsd = this->giveNsd(this->giveGeometryType()); if ( nsd == 1 ) { FloatArray c [ 2 ], cg [ 2 ]; @@ -1009,7 +1009,7 @@ void drawIGAPatchDeformedGeometry(Element *elem, StructuralElementEvaluator *se, #endif const FloatArray *knotVector = interp->giveKnotVector(); - int nsd = interp->giveNsd(); + int nsd = interp->giveNsd(this->giveGeometryType()); se->computeVectorOf(VM_Total, tStep, u); diff --git a/src/oofemlib/iga/iga.h b/src/oofemlib/iga/iga.h index 97420d1e4..6362aafa8 100644 --- a/src/oofemlib/iga/iga.h +++ b/src/oofemlib/iga/iga.h @@ -64,6 +64,7 @@ class OOFEM_EXPORT FEIIGAElementGeometryWrapper : public FEICellGeometry int giveNumberOfVertices() const override { return elem->giveNumberOfNodes(); } const FloatArray &giveVertexCoordinates(int i) const override { return elem->giveNode(i)->giveCoordinates(); } + const Element_Geometry_Type giveGeometryType() const override {return elem->giveGeometryType();} }; @@ -89,14 +90,14 @@ class OOFEM_EXPORT IGAIntegrationElement : public GaussIntegrationRule class OOFEM_EXPORT IGAElement : public Element { protected: -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE IntArray knotSpanParallelMode; #endif public: IGAElement(int n, Domain * aDomain) : Element(n, aDomain) { } void initializeFrom(InputRecord &ir) override; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE elementParallelMode giveKnotSpanParallelMode(int) const override; #endif @@ -105,7 +106,7 @@ class OOFEM_EXPORT IGAElement : public Element #endif protected: - virtual int giveNsd() = 0; // this info is available also from interpolation. Do we need it here ??? + virtual int giveNsd(const Element_Geometry_Type) = 0; // this info is available also from interpolation. Do we need it here ??? }; diff --git a/src/oofemlib/iml/precond.h b/src/oofemlib/iml/precond.h index b42b6ae09..f20c4ef6c 100644 --- a/src/oofemlib/iml/precond.h +++ b/src/oofemlib/iml/precond.h @@ -35,7 +35,7 @@ #ifndef precond_h #define precond_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "floatarray.h" #include "sparsemtrx.h" #include "inputrecord.h" diff --git a/src/oofemlib/initialcondition.h b/src/oofemlib/initialcondition.h index effec5df1..fcae001d9 100644 --- a/src/oofemlib/initialcondition.h +++ b/src/oofemlib/initialcondition.h @@ -93,7 +93,7 @@ class OOFEM_EXPORT InitialCondition : public FEMComponent * @param i Initial condition number. * @param d Domain to which new object will belongs. */ - InitialCondition(int i, Domain * d) : FEMComponent(i, d), initialValueDictionary() { } + InitialCondition(int i, Domain * d) : FEMComponent(i, d), initialValueDictionary(), valType(UnknownBVT), set(0), dofIDs() { } /// Destructor. virtual ~InitialCondition() { } diff --git a/src/oofemlib/initmodule.h b/src/oofemlib/initmodule.h index d1a03c845..0666366ce 100644 --- a/src/oofemlib/initmodule.h +++ b/src/oofemlib/initmodule.h @@ -35,7 +35,7 @@ #ifndef initmodule_h #define initmodule_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "inputrecord.h" #include diff --git a/src/oofemlib/inputrecord.h b/src/oofemlib/inputrecord.h index 98a730f79..fb9b36b32 100644 --- a/src/oofemlib/inputrecord.h +++ b/src/oofemlib/inputrecord.h @@ -42,7 +42,7 @@ #include #include "logger.h" // for missing __func__ in MSC -#include "oofemcfg.h" +#include "oofemenv.h" namespace oofem { class IntArray; diff --git a/src/oofemlib/intarray.C b/src/oofemlib/intarray.C index 246dd4ae3..905f259a0 100644 --- a/src/oofemlib/intarray.C +++ b/src/oofemlib/intarray.C @@ -238,12 +238,12 @@ void IntArray :: printYourselfToFile(const std::string filename, const bool show contextIOResultType IntArray :: storeYourself(DataStream &stream) const { // write size - if ( !stream.write(this->giveSize()) ) { + if ( !stream.write(this->size()) ) { return ( CIO_IOERR ); } // write raw data - if ( !stream.write(values.data(), this->giveSize()) ) { + if ( !stream.write(values.data(), this->size()) ) { return ( CIO_IOERR ); } @@ -254,7 +254,7 @@ contextIOResultType IntArray :: storeYourself(DataStream &stream) const contextIOResultType IntArray :: restoreYourself(DataStream &stream) { // read size - int size; + std::size_t size; if ( !stream.read(size) ) { return ( CIO_IOERR ); } @@ -273,7 +273,7 @@ contextIOResultType IntArray :: restoreYourself(DataStream &stream) int IntArray :: givePackSize(DataStream &buff) const { - return buff.givePackSizeOfInt(1) + buff.givePackSizeOfInt(this->giveSize()); + return buff.givePackSizeOfSizet(1) + buff.givePackSizeOfInt(this->giveSize()); } diff --git a/src/oofemlib/intarray.h b/src/oofemlib/intarray.h index 126041156..b3d91b48d 100644 --- a/src/oofemlib/intarray.h +++ b/src/oofemlib/intarray.h @@ -35,7 +35,7 @@ #ifndef intarray_h #define intarray_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "contextioresulttype.h" #include "contextmode.h" #include "error.h" @@ -98,7 +98,7 @@ class OOFEM_EXPORT IntArray * @param i Position of coefficient in array. * @return Value at position. */ - inline int &at(int i) + inline int &at(std::size_t i) { #ifndef NDEBUG this->checkBounds(i); @@ -111,7 +111,7 @@ class OOFEM_EXPORT IntArray * @param i position of coefficient in array. * @return Value at position. */ - inline int at(int i) const + inline int at(std::size_t i) const { #ifndef NDEBUG this->checkBounds(i); @@ -124,8 +124,8 @@ class OOFEM_EXPORT IntArray * @param i Position of coefficient in array. * @return Value at position. */ - inline int &operator() (int i) { return this->operator[](i); } - inline int &operator[] (int i) + inline int &operator() (std::size_t i) { return this->operator[](i); } + inline int &operator[] (std::size_t i) { #ifndef NDEBUG this->checkBounds(i + 1); @@ -138,8 +138,8 @@ class OOFEM_EXPORT IntArray * @param i position of coefficient in array. * @return Value at position. */ - inline const int &operator() (int i) const { return this->operator[](i); } - inline const int &operator[] (int i) const + inline const int &operator() (std::size_t i) const { return this->operator[](i); } + inline const int &operator[] (std::size_t i) const { #ifndef NDEBUG this->checkBounds(i + 1); @@ -153,11 +153,11 @@ class OOFEM_EXPORT IntArray * mismatch found. * @param i Required size of receiver */ - void checkBounds(int i) const + void checkBounds(std::size_t i) const { if ( i <= 0 ) { OOFEM_ERROR("array error on index : %d <= 0", i); - } else if ( i > this->giveSize() ) { + } else if ( i > values.size()) { OOFEM_ERROR("array error on index : %d > %d", i, this->giveSize()); } } @@ -206,6 +206,7 @@ class OOFEM_EXPORT IntArray void followedBy(int b, int allocChunk = 0); /// @return Size of receiver. int giveSize() const { return (int)values.size(); } + std::size_t size() const { return values.size(); } /** * Checks if receiver is empty (i.e., zero sized). * @return True is size is zero. diff --git a/src/oofemlib/intarrayf.h b/src/oofemlib/intarrayf.h index 97e420ae6..30978d34c 100644 --- a/src/oofemlib/intarrayf.h +++ b/src/oofemlib/intarrayf.h @@ -35,7 +35,7 @@ #ifndef intarray_h #define intarray_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "contextioresulttype.h" #include "contextmode.h" #include "error.h" diff --git a/src/oofemlib/integrationrule.C b/src/oofemlib/integrationrule.C index 30d92906d..c17bd4520 100644 --- a/src/oofemlib/integrationrule.C +++ b/src/oofemlib/integrationrule.C @@ -288,7 +288,7 @@ IntegrationRule :: setUpIntegrationPoints(integrationDomain mode, int nPoints, OOFEM_ERROR("unknown mode (%d)", mode); } - return 0; + //return 0; } int @@ -304,8 +304,7 @@ IntegrationRule :: setUpIntegrationPoints(integrationDomain mode, int nPointsXY, default: OOFEM_ERROR("Unknown mode (%d)", mode); } - - return 0; + //return 0; } int @@ -324,8 +323,7 @@ IntegrationRule :: setUpEmbeddedIntegrationPoints(integrationDomain mode, int nP default: OOFEM_ERROR("unknown mode"); } - - return 0; + //return 0; } diff --git a/src/oofemlib/integrationrule.h b/src/oofemlib/integrationrule.h index a6b8702cc..23f413951 100644 --- a/src/oofemlib/integrationrule.h +++ b/src/oofemlib/integrationrule.h @@ -35,7 +35,7 @@ #ifndef integrationrule_h #define integrationrule_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "materialmode.h" #include "integrationdomain.h" #include "contextioresulttype.h" diff --git a/src/oofemlib/interface.h b/src/oofemlib/interface.h index 00f1c3595..47ff01abf 100644 --- a/src/oofemlib/interface.h +++ b/src/oofemlib/interface.h @@ -35,7 +35,7 @@ #ifndef interface_h #define interface_h -#include "oofemcfg.h" +#include "oofemenv.h" #include diff --git a/src/oofemlib/interpolatingfunction.C b/src/oofemlib/interpolatingfunction.C index b00c0338a..5a58b4205 100644 --- a/src/oofemlib/interpolatingfunction.C +++ b/src/oofemlib/interpolatingfunction.C @@ -249,7 +249,6 @@ double InterpolatingFuction :: evaluateAtTime(double t) { OOFEM_ERROR("InterpolatingFunction needs coordinates to evaluate."); - return 0.; } diff --git a/src/oofemlib/latticedirichletcouplingnode.C b/src/oofemlib/latticedirichletcouplingnode.C index d7fa54ccb..d6bad8d26 100644 --- a/src/oofemlib/latticedirichletcouplingnode.C +++ b/src/oofemlib/latticedirichletcouplingnode.C @@ -223,7 +223,7 @@ void LatticeDirichletCouplingNode :: printOutputAt(FILE *stream, TimeStep *stepN { int i; -#if defined( __PARALLEL_MODE ) || defined( __ENABLE_COMPONENT_LABELS ) +#if defined( __MPI_PARALLEL_MODE ) || defined( __ENABLE_COMPONENT_LABELS ) fprintf( stream, "%-8s%8d (%8d):\n", this->giveClassName(), this->giveLabel(), this->giveNumber() ); #else fprintf( stream, "%-8s%8d:\n", this->giveClassName(), this->giveGlobalNumber() ); diff --git a/src/oofemlib/load.C b/src/oofemlib/load.C index 4b3212432..23f0734a4 100644 --- a/src/oofemlib/load.C +++ b/src/oofemlib/load.C @@ -141,7 +141,7 @@ Load :: isDofExcluded(int indx) OOFEM_ERROR("dof index out of range"); } - return 0; + //return 0; } diff --git a/src/oofemlib/load.h b/src/oofemlib/load.h index c22327d83..7d8e76af3 100644 --- a/src/oofemlib/load.h +++ b/src/oofemlib/load.h @@ -165,7 +165,6 @@ class OOFEM_EXPORT Load : public GeneralBoundaryCondition */ virtual double giveProperty(int aProperty, TimeStep *tStep) { OOFEM_ERROR("Not supported for this boundary condition."); - return 0; } void initializeFrom(InputRecord &ir) override; diff --git a/src/oofemlib/loadbalancer.C b/src/oofemlib/loadbalancer.C index 5483739f9..fcae9bfd8 100644 --- a/src/oofemlib/loadbalancer.C +++ b/src/oofemlib/loadbalancer.C @@ -44,7 +44,7 @@ #include "floatarray.h" #include "intarray.h" -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE #include "processcomm.h" #include "datastream.h" #include "communicator.h" @@ -56,7 +56,7 @@ namespace oofem { //#define __VERBOSE_PARALLEL //#define LoadBalancer_debug_print -#ifndef __PARALLEL_MODE +#ifndef __MPI_PARALLEL_MODE LoadBalancer :: LoadBalancer(Domain *d) : wtpList() { @@ -573,5 +573,5 @@ LoadBalancerMonitor :: initializeFrom(InputRecord &ir) } } -#endif // end __PARALLEL_MODE +#endif // end __MPI_PARALLEL_MODE } // end namespace oofem diff --git a/src/oofemlib/loadbalancer.h b/src/oofemlib/loadbalancer.h index c19f52506..bcd83682f 100644 --- a/src/oofemlib/loadbalancer.h +++ b/src/oofemlib/loadbalancer.h @@ -35,7 +35,7 @@ #ifndef loadbalancer_h #define loadbalancer_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "inputrecord.h" #include "floatarray.h" diff --git a/src/oofemlib/lobattoir.C b/src/oofemlib/lobattoir.C index e09e46587..56b9fbd4d 100644 --- a/src/oofemlib/lobattoir.C +++ b/src/oofemlib/lobattoir.C @@ -121,7 +121,6 @@ int LobattoIntegrationRule :: SetUpPointsOnTriangle(int nPoints, MaterialMode mode) { OOFEM_ERROR("unsupported number of IPs (%d)", nPoints); - return 0; } @@ -148,8 +147,7 @@ LobattoIntegrationRule :: getRequiredNumberOfIntegrationPoints(integrationDomain default: OOFEM_ERROR("unknown integrationDomain"); } - - return -1; + // return -1; } diff --git a/src/oofemlib/localgaussianrandomfunction.C b/src/oofemlib/localgaussianrandomfunction.C index a5b5b77d1..1c77f30c6 100644 --- a/src/oofemlib/localgaussianrandomfunction.C +++ b/src/oofemlib/localgaussianrandomfunction.C @@ -63,14 +63,12 @@ double LocalGaussianRandomFunction :: evaluateVelocityAtTime(double t) { OOFEM_ERROR("Can't generate velocity of random number"); - return 0.; } double LocalGaussianRandomFunction :: evaluateAccelerationAtTime(double t) { OOFEM_ERROR("Can't generate acceleration of random number"); - return 0.; } void @@ -224,7 +222,6 @@ double LocalGaussianRandomFunction :: normal01CdfInverse(double p) if ( r <= 0.0 ) { OOFEM_ERROR("r < 0.0!"); - return -1.0; } r = sqrt( -log(r) ); diff --git a/src/oofemlib/logger.C b/src/oofemlib/logger.C index 8cf45e608..4f8a8c8f6 100644 --- a/src/oofemlib/logger.C +++ b/src/oofemlib/logger.C @@ -37,7 +37,7 @@ #include "util.h" #include -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE #include #endif @@ -57,7 +57,7 @@ Logger :: Logger(logLevelType level) : logLevel(level), numberOfWrn(0), numberOfErr(0) -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE ,comm(MPI_COMM_SELF) #endif {} @@ -149,7 +149,7 @@ Logger :: writeLogMsg(logLevelType level, const char *format, ...) { int rank = 0; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE MPI_Comm_rank(this->comm, & rank); #endif (void)rank;//prevent a warning about unused variable @@ -243,7 +243,7 @@ Logger :: setLogLevel(int level) } } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE void Logger :: setComm(MPI_Comm comm) { @@ -256,12 +256,12 @@ Logger :: printStatistics() { int rank = 0; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE MPI_Comm_rank(this->comm, & rank); #endif int totalNumberOfErr = numberOfErr, totalNumberOfWrn = numberOfWrn; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE MPI_Reduce(& numberOfErr, & totalNumberOfErr, 1, MPI_INT, MPI_SUM, 0, this->comm); MPI_Reduce(& numberOfWrn, & totalNumberOfWrn, 1, MPI_INT, MPI_SUM, 0, this->comm); #endif diff --git a/src/oofemlib/logger.h b/src/oofemlib/logger.h index 6eeccf323..c35c3a1ce 100644 --- a/src/oofemlib/logger.h +++ b/src/oofemlib/logger.h @@ -35,12 +35,12 @@ #ifndef logger_h #define logger_h -#include "oofemcfg.h" +#include "oofemenv.h" //#include "util.h" #include #include -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE #include #endif @@ -75,7 +75,7 @@ class OOFEM_EXPORT Logger logLevelType logLevel; /// Counter of all warning and error messages. int numberOfWrn, numberOfErr; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE /// Parallell comm MPI_Comm comm; #endif @@ -90,7 +90,7 @@ class OOFEM_EXPORT Logger void appendLogTo(FILE* stream); /// Redirects error output to given stream. void appendErrorTo(FILE* stream); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE /// Parallell comm void setComm(MPI_Comm comm); #endif diff --git a/src/oofemlib/masterdof.C b/src/oofemlib/masterdof.C index bd44140d4..9edc996c2 100644 --- a/src/oofemlib/masterdof.C +++ b/src/oofemlib/masterdof.C @@ -76,7 +76,6 @@ BoundaryCondition *MasterDof :: giveBc() } OOFEM_ERROR("Incompatible BC (%d) applied as Dirichlet/Primary BC", bc); - return NULL; } @@ -134,7 +133,6 @@ InitialCondition *MasterDof :: giveIc() return ( dofManager->giveDomain()->giveIc(ic) ); } else { OOFEM_ERROR("does not know yet if has InitCond or not"); - return NULL; } } diff --git a/src/oofemlib/material.C b/src/oofemlib/material.C index e1dcf4342..a342b8e0b 100644 --- a/src/oofemlib/material.C +++ b/src/oofemlib/material.C @@ -64,10 +64,9 @@ Material :: give(int aProperty, GaussPoint *gp) const } double -Material :: giveCharacteristicValue(CharType type, GaussPoint* gp, TimeStep *tStep) +Material :: giveCharacteristicValue(MatResponseMode type, GaussPoint* gp, TimeStep *tStep) const { - OOFEM_ERROR( "Characteristic value %s(%d) on element %d and GP %d not defined", __CharTypeToString(type), type, gp->giveElement()->giveNumber(), gp->giveNumber() ); - return 0.0; + OOFEM_ERROR( "Characteristic value %s(%d) on element %d and GP %d not defined", __MatResponseModeToString(type), type, gp->giveElement()->giveNumber(), gp->giveNumber() ); } bool diff --git a/src/oofemlib/material.h b/src/oofemlib/material.h index 389dc8261..0a01c322d 100644 --- a/src/oofemlib/material.h +++ b/src/oofemlib/material.h @@ -137,17 +137,17 @@ class OOFEM_EXPORT Material : public FEMComponent * @brief Returns characteristic matrix of the receiver * */ - virtual void giveCharacteristicMatrix(FloatMatrix &answer, CharType type, GaussPoint* gp, TimeStep *tStep) {} + virtual void giveCharacteristicMatrix(FloatMatrix &answer, MatResponseMode type, GaussPoint* gp, TimeStep *tStep) const {} /** * @brief Returns characteristic vector of the receiver * */ - virtual void giveCharacteristicVector(FloatArray &answer, FloatArray& flux, CharType type, GaussPoint* gp, TimeStep *tStep) {} + virtual void giveCharacteristicVector(FloatArray &answer, FloatArray& flux, MatResponseMode type, GaussPoint* gp, TimeStep *tStep) const {} /** * @brief Returns characteristic value of the receiver * */ - virtual double giveCharacteristicValue(CharType type, GaussPoint* gp, TimeStep *tStep); + virtual double giveCharacteristicValue(MatResponseMode type, GaussPoint* gp, TimeStep *tStep) const ; /** * Returns the value of material property 'aProperty'. Property must be identified * by unique int id. Integration point also passed to allow for materials with spatially diff --git a/src/oofemlib/materialmappingalgorithm.h b/src/oofemlib/materialmappingalgorithm.h index 63404d58f..a5c725350 100644 --- a/src/oofemlib/materialmappingalgorithm.h +++ b/src/oofemlib/materialmappingalgorithm.h @@ -35,7 +35,7 @@ #ifndef materialmappingalgorithm_h #define materialmappingalgorithm_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "interface.h" #include "intarray.h" #include "inputrecord.h" diff --git a/src/oofemlib/mathfem.h b/src/oofemlib/mathfem.h index 8ac6e3fd3..458c02f48 100644 --- a/src/oofemlib/mathfem.h +++ b/src/oofemlib/mathfem.h @@ -40,7 +40,7 @@ #define mathfem_h #include "error.h" -#include "oofemcfg.h" +#include "oofemenv.h" #include #include // For _isnan @@ -63,6 +63,19 @@ inline int min(int i, int j) inline long min(long i, long j) { return ( i <= j ? i : j ); } +/// Returns smaller value from two given long decimals +inline unsigned long min(unsigned long i, unsigned long j) +{ + return (i <= j ? i : j); +} + +#ifdef _MSC_VER +/// Returns smaller value from two given decimals +inline std::size_t min(std::size_t i, std::size_t j) +{ return ( i <= j ? i : j ); } +#endif + + /// Returns smaller value from two given floats inline double min(double i, double j) { return ( i <= j ? i : j ); } diff --git a/src/oofemlib/matresponsemode.h b/src/oofemlib/matresponsemode.h index 6f180a633..858eb7b1e 100644 --- a/src/oofemlib/matresponsemode.h +++ b/src/oofemlib/matresponsemode.h @@ -41,7 +41,8 @@ namespace oofem { #define MatResponseMode_DEF \ ENUM_ITEM(TangentStiffness) \ ENUM_ITEM(SecantStiffness) \ - ENUM_ITEM(ElasticStiffness) \ + ENUM_ITEM(ElasticStiffness) \ + ENUM_ITEM(Stress) \ ENUM_ITEM(Conductivity) /* element level conductivity matrix */ \ ENUM_ITEM(Conductivity_ww) /* material level conductivity submatrix */ \ ENUM_ITEM(Conductivity_hh) /* material level conductivity submatrix */ \ @@ -56,7 +57,14 @@ namespace oofem { ENUM_ITEM(IntSource_ww) /* material level internal source submatrix - water source */ \ ENUM_ITEM(IntSource_hh) /* - heat source */ \ ENUM_ITEM(IntSource_hw) /* - heat source dependency on water content change */ \ - ENUM_ITEM(IntSource_wh) /* - water source dependency on temperature change */ + ENUM_ITEM(IntSource_wh) /* - water source dependency on temperature change */ \ + ENUM_ITEM(Permeability) \ + ENUM_ITEM(FluidMassBalancePressureContribution) \ + ENUM_ITEM(BiotConstant) \ + ENUM_ITEM(CompressibilityCoefficient) \ + ENUM_ITEM(FluidViscosity) \ + ENUM_ITEM(Flux) \ + ENUM_ITEM(DSigmaDT) /** * Describes the character of characteristic material matrix. diff --git a/src/oofemlib/mesherinterface.h b/src/oofemlib/mesherinterface.h index 7f42e2e01..f18ca5cff 100644 --- a/src/oofemlib/mesherinterface.h +++ b/src/oofemlib/mesherinterface.h @@ -35,7 +35,7 @@ #ifndef mesherinterface_h #define mesherinterface_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "inputrecord.h" namespace oofem { diff --git a/src/oofemlib/metastep.h b/src/oofemlib/metastep.h index f72b90721..9eb0df3a9 100644 --- a/src/oofemlib/metastep.h +++ b/src/oofemlib/metastep.h @@ -35,7 +35,7 @@ #ifndef metastep_h #define metastep_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "inputrecord.h" #include diff --git a/src/oofemlib/mixedgradientpressuredirichlet.C b/src/oofemlib/mixedgradientpressuredirichlet.C index af25387d7..dfacba6b5 100644 --- a/src/oofemlib/mixedgradientpressuredirichlet.C +++ b/src/oofemlib/mixedgradientpressuredirichlet.C @@ -436,7 +436,7 @@ double MixedGradientPressureDirichlet :: giveBcValue(Dof *dof, ValueModeType mod return this->devGradient( dev_id.findFirstIndexOf(dof->giveDofID()) ); } OOFEM_ERROR("Has no prescribed value from bc."); - return 0.0; + //return 0.0; } diff --git a/src/oofemlib/mixedgradientpressureneumann.C b/src/oofemlib/mixedgradientpressureneumann.C index bd81b90ca..6fbf5a847 100644 --- a/src/oofemlib/mixedgradientpressureneumann.C +++ b/src/oofemlib/mixedgradientpressureneumann.C @@ -262,7 +262,7 @@ void MixedGradientPressureNeumann :: giveLocationArrays(std :: vector< IntArray Element *e = this->giveDomain()->giveElement( boundaries.at(pos * 2 - 1) ); int boundary = boundaries.at(pos * 2); - const auto &bNodes = e->giveInterpolation()->boundaryGiveNodes(boundary); + const auto &bNodes = e->giveInterpolation()->boundaryGiveNodes(boundary, e->giveGeometryType()); e->giveBoundaryLocationArray(loc_r, bNodes, this->dofs, r_s); e->giveBoundaryLocationArray(loc_c, bNodes, this->dofs, c_s); // For most uses, loc_r == loc_c, and sigma_loc_r == sigma_loc_c. @@ -293,7 +293,7 @@ void MixedGradientPressureNeumann :: integrateVolTangent(FloatArray &answer, Ele int nsd = e->giveDomain()->giveNumberOfSpatialDimensions(); // Order here should be the normal (which takes the first derivative) thus -1 int order = interp->giveInterpolationOrder() - 1 + interpUnknown->giveInterpolationOrder(); - std :: unique_ptr< IntegrationRule > ir( interp->giveBoundaryIntegrationRule(order, boundary) ); + std :: unique_ptr< IntegrationRule > ir( interp->giveBoundaryIntegrationRule(order, boundary, e->giveGeometryType()) ); answer.clear(); for ( GaussPoint *gp: *ir ) { @@ -328,7 +328,7 @@ void MixedGradientPressureNeumann :: integrateDevTangent(FloatMatrix &answer, El int nsd = e->giveDomain()->giveNumberOfSpatialDimensions(); // Order here should be the normal (which takes the first derivative) thus -1 int order = interp->giveInterpolationOrder() - 1 + interpUnknown->giveInterpolationOrder(); - std :: unique_ptr< IntegrationRule > ir( interp->giveBoundaryIntegrationRule(order, boundary) ); + std :: unique_ptr< IntegrationRule > ir( interp->giveBoundaryIntegrationRule(order, boundary, e->giveGeometryType()) ); answer.clear(); for ( auto &gp: *ir ) { @@ -429,7 +429,7 @@ void MixedGradientPressureNeumann :: assembleVector(FloatArray &answer, TimeStep Element *e = this->giveDomain()->giveElement( boundaries.at(pos * 2 - 1) ); int boundary = boundaries.at(pos * 2); - const auto &bNodes = e->giveInterpolation()->boundaryGiveNodes(boundary); + const auto &bNodes = e->giveInterpolation()->boundaryGiveNodes(boundary, e->giveGeometryType()); e->giveBoundaryLocationArray(loc, bNodes, this->dofs, s, & masterDofIDs); this->integrateVolTangent(fe, e, boundary); fe.times(-this->pressure); @@ -459,7 +459,7 @@ void MixedGradientPressureNeumann :: assembleVector(FloatArray &answer, TimeStep int boundary = boundaries.at(pos * 2); // Fetch the element information; - const auto &bNodes = e->giveInterpolation()->boundaryGiveNodes(boundary); + const auto &bNodes = e->giveInterpolation()->boundaryGiveNodes(boundary, e->giveGeometryType()); e->giveBoundaryLocationArray(loc, bNodes, this->dofs, s, & masterDofIDs); e->computeBoundaryVectorOf(bNodes, this->dofs, mode, tStep, e_v); this->integrateDevTangent(Ke, e, boundary); @@ -508,7 +508,7 @@ void MixedGradientPressureNeumann :: assemble(SparseMtrx &answer, TimeStep *tSte int boundary = boundaries.at(pos * 2); // Fetch the element information; - const auto &bNodes = e->giveInterpolation()->boundaryGiveNodes(boundary); + const auto &bNodes = e->giveInterpolation()->boundaryGiveNodes(boundary, e->giveGeometryType()); e->giveBoundaryLocationArray(loc_r, bNodes, this->dofs, r_s); e->giveBoundaryLocationArray(loc_c, bNodes, this->dofs, c_s); this->integrateDevTangent(Ke, e, boundary); @@ -556,7 +556,7 @@ void MixedGradientPressureNeumann :: computeFields(FloatArray &sigmaDev, double Element *e = this->giveDomain()->giveElement( boundaries.at(pos * 2 - 1) ); int boundary = boundaries.at(pos * 2); - const auto &bNodes = e->giveInterpolation()->boundaryGiveNodes(boundary); + const auto &bNodes = e->giveInterpolation()->boundaryGiveNodes(boundary, e->giveGeometryType()); e->computeBoundaryVectorOf(bNodes, this->dofs, VM_Total, tStep, unknowns); this->integrateVolTangent(fe, e, boundary); vol += fe.dotProduct(unknowns); @@ -616,7 +616,7 @@ void MixedGradientPressureNeumann :: computeTangents(FloatMatrix &Ed, FloatArray Element *e = this->giveDomain()->giveElement( boundaries.at(pos * 2 - 1) ); int boundary = boundaries.at(pos * 2); - const auto &bNodes = e->giveInterpolation()->boundaryGiveNodes(boundary); + const auto &bNodes = e->giveInterpolation()->boundaryGiveNodes(boundary, e->giveGeometryType()); e->giveBoundaryLocationArray(loc, bNodes, this->dofs, fnum); this->integrateVolTangent(fe, e, boundary); fe.times(-1.0); // here d_p = 1.0 @@ -648,7 +648,7 @@ void MixedGradientPressureNeumann :: computeTangents(FloatMatrix &Ed, FloatArray this->integrateVolTangent(fe, e, boundary); - const auto &bNodes = e->giveInterpolation()->boundaryGiveNodes(boundary); + const auto &bNodes = e->giveInterpolation()->boundaryGiveNodes(boundary, e->giveGeometryType()); e->giveBoundaryLocationArray(loc, bNodes, this->dofs, fnum); // Using "loc" to pick out the relevant contributions. This won't work at all if there are local coordinate systems in these nodes diff --git a/src/oofemlib/mixedgradientpressureweakperiodic.C b/src/oofemlib/mixedgradientpressureweakperiodic.C index 46240b67a..73778849d 100644 --- a/src/oofemlib/mixedgradientpressureweakperiodic.C +++ b/src/oofemlib/mixedgradientpressureweakperiodic.C @@ -179,7 +179,7 @@ void MixedGradientPressureWeakPeriodic :: giveLocationArrays(std :: vector< IntA Element *e = this->giveDomain()->giveElement( boundaries.at(pos * 2 - 1) ); int boundary = boundaries.at(pos * 2); - const auto &bNodes = e->giveInterpolation()->boundaryGiveNodes(boundary); + const auto &bNodes = e->giveInterpolation()->boundaryGiveNodes(boundary, e->giveGeometryType()); e->giveBoundaryLocationArray(loc_r, bNodes, this->dofs, r_s); e->giveBoundaryLocationArray(loc_c, bNodes, this->dofs, c_s); // For most uses, *loc_r == *loc_c @@ -261,7 +261,7 @@ void MixedGradientPressureWeakPeriodic :: integrateTractionVelocityTangent(Float FEInterpolation *interp = el->giveInterpolation(); // Geometry interpolation. The displacements or velocities must have the same interpolation scheme (on the boundary at least). int maxorder = this->order + interp->giveInterpolationOrder() * 3; - std :: unique_ptr< IntegrationRule >ir( interp->giveBoundaryIntegrationRule(maxorder, boundary) ); + std :: unique_ptr< IntegrationRule >ir( interp->giveBoundaryIntegrationRule(maxorder, boundary, el->giveGeometryType()) ); int nsd = this->giveDomain()->giveNumberOfSpatialDimensions(); answer.clear(); @@ -291,7 +291,7 @@ void MixedGradientPressureWeakPeriodic :: integrateTractionXTangent(FloatMatrix FEInterpolation *interp = el->giveInterpolation(); // Geometry interpolation. The displacements or velocities must have the same interpolation scheme (on the boundary at least). int maxorder = this->order + interp->giveInterpolationOrder() * 3; - std :: unique_ptr< IntegrationRule >ir( interp->giveBoundaryIntegrationRule(maxorder, boundary) ); + std :: unique_ptr< IntegrationRule >ir( interp->giveBoundaryIntegrationRule(maxorder, boundary, el->giveGeometryType()) ); FloatArray tmpAnswer; for ( GaussPoint *gp: *ir ) { @@ -320,7 +320,7 @@ void MixedGradientPressureWeakPeriodic :: integrateTractionDev(FloatArray &answe FEInterpolation *interp = el->giveInterpolation(); // Geometry interpolation. The displacements or velocities must have the same interpolation scheme (on the boundary at least). int maxorder = this->order + interp->giveInterpolationOrder() * 3; - std :: unique_ptr< IntegrationRule >ir( interp->giveBoundaryIntegrationRule(maxorder, boundary) ); + std :: unique_ptr< IntegrationRule >ir( interp->giveBoundaryIntegrationRule(maxorder, boundary, el->giveGeometryType()) ); answer.clear(); for ( GaussPoint *gp: *ir ) { @@ -406,7 +406,7 @@ void MixedGradientPressureWeakPeriodic :: assembleVector(FloatArray &answer, Tim int boundary = boundaries.at(pos * 2); // Fetch the element information; - const auto &bNodes = el->giveInterpolation()->boundaryGiveNodes(boundary); + const auto &bNodes = el->giveInterpolation()->boundaryGiveNodes(boundary, el->giveGeometryType()); el->giveBoundaryLocationArray(v_loc, bNodes, this->dofs, s, & velocityDofIDs); el->computeBoundaryVectorOf(bNodes, this->dofs, mode, tStep, v); @@ -464,7 +464,7 @@ void MixedGradientPressureWeakPeriodic :: assemble(SparseMtrx &answer, TimeStep int boundary = boundaries.at(pos * 2); // Fetch the element information; - const auto &bNodes = el->giveInterpolation()->boundaryGiveNodes(boundary); + const auto &bNodes = el->giveInterpolation()->boundaryGiveNodes(boundary, el->giveGeometryType()); el->giveBoundaryLocationArray(v_loc_r, bNodes, this->dofs, r_s); el->giveBoundaryLocationArray(v_loc_c, bNodes, this->dofs, c_s); @@ -526,7 +526,7 @@ void MixedGradientPressureWeakPeriodic :: computeStress(FloatArray &sigmaDev, Fl FEInterpolation *interp = el->giveInterpolation(); // Geometry interpolation. The displacements or velocities must have the same interpolation scheme (on the boundary at least). int maxorder = this->order + interp->giveInterpolationOrder() * 3; - std :: unique_ptr< IntegrationRule >ir( interp->giveBoundaryIntegrationRule(maxorder, boundary) ); + std :: unique_ptr< IntegrationRule >ir( interp->giveBoundaryIntegrationRule(maxorder, boundary, el->giveGeometryType()) ); for ( GaussPoint *gp: *ir ) { const FloatArray &lcoords = gp->giveNaturalCoordinates(); diff --git a/src/oofemlib/mmaclosestiptransfer.C b/src/oofemlib/mmaclosestiptransfer.C index 70c9fdb11..3c36d8406 100644 --- a/src/oofemlib/mmaclosestiptransfer.C +++ b/src/oofemlib/mmaclosestiptransfer.C @@ -87,6 +87,6 @@ MMAClosestIPTransfer :: mapStatus(MaterialStatus &oStatus) const OOFEM_ERROR("source not set."); } - return 0; + //return 0; } } // end namespace oofem diff --git a/src/oofemlib/mmacontainingelementprojection.C b/src/oofemlib/mmacontainingelementprojection.C index de43cddd0..7ca50da25 100644 --- a/src/oofemlib/mmacontainingelementprojection.C +++ b/src/oofemlib/mmacontainingelementprojection.C @@ -88,7 +88,5 @@ int MMAContainingElementProjection :: mapStatus(MaterialStatus &oStatus) const { OOFEM_ERROR("mapStatus() is not implemented yet.") - - return 0; } } // end namespace oofem diff --git a/src/oofemlib/mmaleastsquareprojection.C b/src/oofemlib/mmaleastsquareprojection.C index 5e0343369..3072c336a 100644 --- a/src/oofemlib/mmaleastsquareprojection.C +++ b/src/oofemlib/mmaleastsquareprojection.C @@ -50,6 +50,7 @@ MMALeastSquareProjection :: MMALeastSquareProjection() : MaterialMappingAlgorith { this->stateFilter = 0; this->regionFilter = 1; + this->patchDomain = NULL; } MMALeastSquareProjection :: ~MMALeastSquareProjection() { } @@ -279,7 +280,7 @@ MMALeastSquareProjection :: __mapVariable(FloatArray &answer, const FloatArray & a.zero(); // determine the value from patch - int size = patchGPList.size(); + int size = (int) patchGPList.size(); if ( size == 1 ) { GaussPoint *srcgp = *patchGPList.begin(); srcgp->giveElement()->giveIPValue(answer, srcgp, type, tStep); @@ -360,8 +361,6 @@ int MMALeastSquareProjection :: mapStatus(MaterialStatus &oStatus) const { OOFEM_ERROR("not implemented yet.") - - return 0; } void diff --git a/src/oofemlib/mmashapefunctprojection.C b/src/oofemlib/mmashapefunctprojection.C index d85690933..306cceec7 100644 --- a/src/oofemlib/mmashapefunctprojection.C +++ b/src/oofemlib/mmashapefunctprojection.C @@ -157,7 +157,6 @@ MMAShapeFunctProjection :: mapStatus(MaterialStatus &oStatus) const { OOFEM_ERROR("not implemented yet.") - return 0; } diff --git a/src/oofemlib/monitor.h b/src/oofemlib/monitor.h index b695b5bbb..3397b5099 100644 --- a/src/oofemlib/monitor.h +++ b/src/oofemlib/monitor.h @@ -35,7 +35,7 @@ #ifndef monitor_h #define monitor_h -#include "oofemcfg.h" +#include "oofemenv.h" namespace oofem { class EngngModel; diff --git a/src/oofemlib/neumannmomentload.C b/src/oofemlib/neumannmomentload.C index c560b7c41..1a4c013dc 100644 --- a/src/oofemlib/neumannmomentload.C +++ b/src/oofemlib/neumannmomentload.C @@ -77,7 +77,7 @@ NeumannMomentLoad :: computeXbar() Element *thisElement = this->giveDomain()->giveElement(elementID); FEInterpolation *i = thisElement->giveInterpolation(); - auto iRule = i->giveIntegrationRule(3); + auto iRule = i->giveIntegrationRule(3, thisElement->giveGeometryType() ); FloatArray coord; for ( auto &gp: *iRule ) { @@ -103,17 +103,18 @@ NeumannMomentLoad :: computeValueAt(FloatArray &answer, TimeStep *tStep, const F computeXbar(); - double factor; + //double factor; if ( ( mode != VM_Total ) && ( mode != VM_Incremental ) ) { OOFEM_ERROR("mode not supported"); } OOFEM_ERROR("Should not happen!"); - +/* factor = this->giveTimeFunction()->evaluate(tStep, mode); answer = componentArray; answer.times(factor); +*/ } void diff --git a/src/oofemlib/nodalaveragingrecoverymodel.C b/src/oofemlib/nodalaveragingrecoverymodel.C index bf5631fff..9d023ce10 100644 --- a/src/oofemlib/nodalaveragingrecoverymodel.C +++ b/src/oofemlib/nodalaveragingrecoverymodel.C @@ -39,7 +39,7 @@ #include "engngm.h" #include "classfactory.h" -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE #include "problemcomm.h" #include "processcomm.h" #include "communicator.h" @@ -67,7 +67,7 @@ NodalAveragingRecoveryModel :: recoverValues(Set elementSet, InternalStateType t return 1; } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE bool parallel = this->domain->giveEngngModel()->isParallel(); if ( parallel ) { this->initCommMaps(); @@ -131,7 +131,7 @@ NodalAveragingRecoveryModel :: recoverValues(Set elementSet, InternalStateType t } } // end assemble element contributions -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( parallel ) { this->exchangeDofManValues(lhs, regionDofMansConnectivity, regionNodalNumbers, regionValSize); } @@ -160,7 +160,7 @@ NodalAveragingRecoveryModel :: recoverValues(Set elementSet, InternalStateType t return 1; } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE void NodalAveragingRecoveryModel :: initCommMaps() diff --git a/src/oofemlib/nodalaveragingrecoverymodel.h b/src/oofemlib/nodalaveragingrecoverymodel.h index f2ea5e310..47883b0e7 100644 --- a/src/oofemlib/nodalaveragingrecoverymodel.h +++ b/src/oofemlib/nodalaveragingrecoverymodel.h @@ -76,7 +76,7 @@ class OOFEM_EXPORT NodalAveragingRecoveryModel : public NodalRecoveryModel const char *giveClassName() const override { return "NodalAveragingRecoveryModel"; } private: -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE void initCommMaps(); void exchangeDofManValues(FloatArray &lhs, IntArray &, IntArray &, int); int packSharedDofManData(parallelStruct *s, ProcessCommunicator &processComm); diff --git a/src/oofemlib/nodalrecoverymodel.C b/src/oofemlib/nodalrecoverymodel.C index cd36b4ebb..1611863e0 100644 --- a/src/oofemlib/nodalrecoverymodel.C +++ b/src/oofemlib/nodalrecoverymodel.C @@ -37,7 +37,7 @@ #include "element.h" #include "dofmanager.h" -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE #include "problemcomm.h" #endif @@ -49,7 +49,7 @@ NodalRecoveryModel :: NodalRecoveryModel(Domain *d) : nodalValList() domain = d; this->valType = IST_Undefined; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE communicator = NULL; commBuff = NULL; initCommMap = true; @@ -59,7 +59,7 @@ NodalRecoveryModel :: NodalRecoveryModel(Domain *d) : nodalValList() NodalRecoveryModel :: ~NodalRecoveryModel() { -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE delete communicator; delete commBuff; #endif diff --git a/src/oofemlib/nodalrecoverymodel.h b/src/oofemlib/nodalrecoverymodel.h index 5161f60a3..233943fbc 100644 --- a/src/oofemlib/nodalrecoverymodel.h +++ b/src/oofemlib/nodalrecoverymodel.h @@ -35,7 +35,7 @@ #ifndef nodalrecoverymodel_h #define nodalrecoverymodel_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "intarray.h" #include "floatarray.h" #include "interface.h" @@ -79,7 +79,7 @@ class OOFEM_EXPORT NodalRecoveryModel StateCounterType stateCounter; Domain *domain; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE /// Common Communicator buffer. CommunicatorBuff *commBuff; /// Communicator. diff --git a/src/oofemlib/node.C b/src/oofemlib/node.C index 705523aed..62cdeb0df 100644 --- a/src/oofemlib/node.C +++ b/src/oofemlib/node.C @@ -223,7 +223,6 @@ Node :: giveUpdatedCoordinate(int ic, TimeStep *tStep, double scale) #ifdef DEBUG if ( ( ic < 1 ) || ( ic > 3 ) ) { OOFEM_ERROR("Can't return non-existing coordinate (index not in range 1..3)"); - return 0.; } #endif @@ -273,7 +272,7 @@ Node :: giveUpdatedCoordinate(int ic, TimeStep *tStep, double scale) OOFEM_ERROR("Can't return updatedCoordinate for non-current timestep"); } - return 0.; + // return 0.; } diff --git a/src/oofemlib/nonlocalmaterialext.C b/src/oofemlib/nonlocalmaterialext.C index e9901cfee..bc4089697 100644 --- a/src/oofemlib/nonlocalmaterialext.C +++ b/src/oofemlib/nonlocalmaterialext.C @@ -45,7 +45,7 @@ #include "mathfem.h" #include "dynamicinputrecord.h" -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE #include "parallel.h" #endif #ifdef _OPENMP @@ -295,7 +295,7 @@ void } // loop over elements statusExt->setIntegrationScale(integrationVolume); // remember scaling factor -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE #ifdef __VERBOSE_PARALLEL fprintf( stderr, "%d(%d):", gp->giveElement()->giveGlobalNumber(), gp->giveNumber() ); for ( auto &lir : *iList ) { diff --git a/src/oofemlib/nummet.h b/src/oofemlib/nummet.h index 4616edc53..337911f26 100644 --- a/src/oofemlib/nummet.h +++ b/src/oofemlib/nummet.h @@ -35,7 +35,7 @@ #ifndef nummet_h #define nummet_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "inputrecord.h" #include "contextioresulttype.h" #include "contextmode.h" diff --git a/src/oofemlib/octreelocalizer.C b/src/oofemlib/octreelocalizer.C index 522e41fbd..1eaceba2d 100644 --- a/src/oofemlib/octreelocalizer.C +++ b/src/oofemlib/octreelocalizer.C @@ -89,7 +89,7 @@ OctantRec :: giveChild(int xi, int yi, int zi) OOFEM_ERROR("invalid child index (%d,%d,%d)", xi, yi, zi); } - return nullptr; + // return nullptr; } @@ -506,7 +506,7 @@ OctreeSpatialLocalizer :: insertNodeIntoOctree(OctantRec &rootCell, int nodeNum, OctantRec *currCell = this->findTerminalContaining(rootCell, coords); // request cell node list nodeContainerType &cellNodeList = currCell->giveNodeList(); - int nCellItems = cellNodeList.size(); + int nCellItems = (int) cellNodeList.size(); int cellDepth = currCell->giveCellDepth(); // check for refinement criteria // should also include max refinement level criteria diff --git a/src/oofemlib/octreelocalizer.h b/src/oofemlib/octreelocalizer.h index 1a75381a2..7c5762855 100644 --- a/src/oofemlib/octreelocalizer.h +++ b/src/oofemlib/octreelocalizer.h @@ -35,7 +35,7 @@ #ifndef octreelocalizer_h #define octreelocalizer_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "spatiallocalizer.h" #include "floatarray.h" #include "intarray.h" diff --git a/src/oofemlib/octreelocalizert.h b/src/oofemlib/octreelocalizert.h index 41b2aec29..e5fd976df 100644 --- a/src/oofemlib/octreelocalizert.h +++ b/src/oofemlib/octreelocalizert.h @@ -62,7 +62,7 @@ class IntArray; template< class T >class OctreeSpatialLocalizerT; -#define TEMPLATED_OCTREE_MAX_NODES_LIMIT 800 +#define TEMPLATED_OCTREE_MAX_NODES_LIMIT 500 #define TEMPLATED_OCTREE_MAX_DEPTH 8 @@ -88,7 +88,7 @@ class BoundingBox public: /// Constructor - BoundingBox() : spatialMask(3) { } + BoundingBox() : size(0), spatialMask(3) { } /// Destructor ~BoundingBox() { } @@ -121,10 +121,10 @@ class BoundingBox /** * Sets all BBOx parameters in ince */ - void init (FloatArray& origin, double size, IntArray &mask) + void init (FloatArray& _origin, double _size, IntArray &mask) { - this->origin = origin; - this->size = size; + this->origin = _origin; + this->size = _size; this->spatialMask = mask; } bool contains(const FloatArray& coords) const @@ -252,7 +252,6 @@ class OctantRecT } else { OOFEM_ERROR("OctantRecT::giveChild invalid child index (%d,%d,%d)", xi, yi, zi); } - return NULL; } /** @@ -310,7 +309,6 @@ class OctantRecT if ( this->isTerminalOctant() ) { // create corresponding child octants - int i, j, k; FloatArray childOrigin(3); for ( i = 0; i <= octantMask.at(1); i++ ) { @@ -348,43 +346,23 @@ class OctantRecT * @param testedBBX Tested bounding box * @returns BoundingBoxStatus status */ - OctantRec :: BoundingBoxStatus testBoundingBox(BoundingBox &testedBBX) + OctantRec :: BoundingBoxStatus testBoundingBox(BoundingBox &A) { - int i, test = 0; - double BBXSize = testedBBX.giveSize(); - FloatArray BBXOrigin; - testedBBX.giveOrigin(BBXOrigin); - int BBXOriginInside = this->containsPoint(BBXOrigin); - if ( BBXOriginInside ) { - for ( i = 1; i <= 3; i++ ) { - if ( localizer->giveOctreeMaskValue(i) ) { - if ( this->size > ( BBXSize + ( BBXOrigin.at(i) - this->origin.at(i) ) ) ) { - test = 1; - } - } - } - - if ( test ) { - return OctantRec :: BBS_InsideCell; - } else { - return OctantRec :: BBS_ContainsCell; - } + double aSize = A.giveSize(); + FloatArray sA,eA; + A.giveOrigin(sA); + eA = sA; + eA.add(aSize); + + bool sAInside = this->containsPoint(sA); + bool eAInside = this->containsPoint(eA); + if (sAInside && eAInside) { + return OctantRec :: BBS_InsideCell; + } else if (sAInside || eAInside) { + return OctantRec :: BBS_ContainsCell; } else { - for ( i = 1; i <= 3; i++ ) { - if ( localizer->giveOctreeMaskValue(i) ) { - if ( BBXOrigin.at(i) > ( this->size + this->origin.at(i) ) ) { - return OctantRec :: BBS_OutsideCell; - } else { - if ( BBXOrigin.at(i) + BBXSize > this->origin.at(i) ) { - return OctantRec :: BBS_ContainsCell; - } else { - return OctantRec :: BBS_OutsideCell; - } - } - } - } + return OctantRec :: BBS_OutsideCell; } - return OctantRec :: BBS_OutsideCell; } /** diff --git a/src/oofemlib/oofeggraphiccontext.h b/src/oofemlib/oofeggraphiccontext.h index 7b79c5cec..5d81e4714 100644 --- a/src/oofemlib/oofeggraphiccontext.h +++ b/src/oofemlib/oofeggraphiccontext.h @@ -38,7 +38,7 @@ #pragma once -#include "oofemcfg.h" +#include "oofemenv.h" #include "intarray.h" #include "internalstatemode.h" #include "internalstatetype.h" diff --git a/src/oofemcfg.C b/src/oofemlib/oofemcfg.C similarity index 93% rename from src/oofemcfg.C rename to src/oofemlib/oofemcfg.C index 2043cf124..592f06d87 100644 --- a/src/oofemcfg.C +++ b/src/oofemlib/oofemcfg.C @@ -1,7 +1,7 @@ #include "oofem_version.h" #include "oofemcfg.h" -OOFEM_EXPORT const char* PRG_VERSION = "OOFEM version" __OOFEM_MAJOR_VERSION "." __OOFEM_MINOR_VERSION; +OOFEM_EXPORT const char* PRG_VERSION = "OOFEM version " __OOFEM_MAJOR_VERSION "." __OOFEM_MINOR_VERSION; OOFEM_EXPORT const char* OOFEM_VERSION = __OOFEM_VERSION; OOFEM_EXPORT const char* OOFEM_COPYRIGHT = __OOFEM_COPYRIGHT; OOFEM_EXPORT const char* OOFEM_GIT_HASH = __OOFEM_GIT_HASH; diff --git a/src/oofemlib/oofemtxtinputrecord.h b/src/oofemlib/oofemtxtinputrecord.h index cbaf9b1dd..d2548c511 100644 --- a/src/oofemlib/oofemtxtinputrecord.h +++ b/src/oofemlib/oofemtxtinputrecord.h @@ -100,7 +100,7 @@ class OOFEM_EXPORT OOFEMTXTInputRecord : public InputRecord bool hasField(InputFieldType id) override; void printYourself() override; - void setLineNumber(int lineNumber) { this->lineNumber = lineNumber; } + void setLineNumber(int num) { this->lineNumber = num; } protected: int giveKeywordIndx(const char *kwd); diff --git a/src/oofemlib/outputexportmodule.C b/src/oofemlib/outputexportmodule.C index cf4ac46f5..136651ad0 100644 --- a/src/oofemlib/outputexportmodule.C +++ b/src/oofemlib/outputexportmodule.C @@ -35,6 +35,7 @@ #include #include +#include "oofemcfg.h" #include "outputexportmodule.h" #include "engngm.h" #include "domain.h" diff --git a/src/oofemlib/outputmanager.h b/src/oofemlib/outputmanager.h index 66ad597cd..9e60d5701 100644 --- a/src/oofemlib/outputmanager.h +++ b/src/oofemlib/outputmanager.h @@ -35,7 +35,7 @@ #ifndef outputmanager_h #define outputmanager_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "intarray.h" #include "range.h" #include "inputrecord.h" diff --git a/src/oofemlib/parallelcontext.C b/src/oofemlib/parallelcontext.C index cf7851739..cb1df90f2 100644 --- a/src/oofemlib/parallelcontext.C +++ b/src/oofemlib/parallelcontext.C @@ -41,7 +41,7 @@ namespace oofem { //#define ParallelContext_debug_print ParallelContext :: ParallelContext(EngngModel *e) -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE : n2g(), n2l() #endif { @@ -56,7 +56,7 @@ ParallelContext :: init(int newDi) { di = newDi; ///@todo Should we even do this here? The user of the requested ParallelContext will just set this manually instead. -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( emodel->isParallel() ) { ///@todo This shouldn't be hardcoded to just the default numbering schemes. In fact, this shouldn't even have "prescribed" and "free", just use the given numbering. n2g.init( emodel, di, EModelDefaultEquationNumbering() ); @@ -74,14 +74,14 @@ ParallelContext :: init(int newDi) int ParallelContext :: giveNumberOfLocalEqs() { -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( emodel->isParallel() ) { return n2g.giveNumberOfLocalEqs(); } else { #endif return emodel->giveNumberOfDomainEquations( di, EModelDefaultEquationNumbering() ); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE } #endif } @@ -90,14 +90,14 @@ ParallelContext :: giveNumberOfLocalEqs() int ParallelContext :: giveNumberOfGlobalEqs() { -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( emodel->isParallel() ) { return n2g.giveNumberOfGlobalEqs(); } else { #endif return emodel->giveNumberOfDomainEquations( di, EModelDefaultEquationNumbering() ); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE } #endif } @@ -126,7 +126,7 @@ ParallelContext :: isLocal(DofManager *dman) double ParallelContext :: localNorm(const FloatArray &src) { -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( emodel->isParallel() ) { double norm2 = 0.0, norm2_tot; int size = src.giveSize(); @@ -147,7 +147,7 @@ ParallelContext :: localNorm(const FloatArray &src) double ParallelContext :: localDotProduct(const FloatArray &a, const FloatArray &b) { -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( emodel->isParallel() ) { double val = 0.0, val_tot = 0.0; int size = a.giveSize(); @@ -168,7 +168,7 @@ ParallelContext :: localDotProduct(const FloatArray &a, const FloatArray &b) double ParallelContext :: accumulate(double local) { -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( emodel->isParallel() ) { double global; MPI_Allreduce( & local, & global, 1, MPI_DOUBLE, MPI_SUM, this->emodel->giveParallelComm() ); @@ -183,7 +183,7 @@ ParallelContext :: accumulate(double local) void ParallelContext :: accumulate(const FloatArray &local, FloatArray &global) { -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( emodel->isParallel() ) { int size = local.giveSize(); global.resize(size); @@ -192,7 +192,7 @@ ParallelContext :: accumulate(const FloatArray &local, FloatArray &global) } else { #endif global = local; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE } #endif } diff --git a/src/oofemlib/parallelcontext.h b/src/oofemlib/parallelcontext.h index 1fcf73609..ef82acd05 100644 --- a/src/oofemlib/parallelcontext.h +++ b/src/oofemlib/parallelcontext.h @@ -35,8 +35,8 @@ #ifndef parallelcontext_h #define parallelcontext_h -#include "oofemcfg.h" -#ifdef __PARALLEL_MODE +#include "oofemenv.h" +#ifdef __MPI_PARALLEL_MODE #include "parallelordering.h" #endif @@ -56,7 +56,7 @@ class OOFEM_EXPORT ParallelContext protected: int di; EngngModel *emodel; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE Natural2GlobalOrdering n2g; Natural2LocalOrdering n2l; #endif @@ -108,7 +108,7 @@ class OOFEM_EXPORT ParallelContext void accumulate(const FloatArray &local, FloatArray &global); //@} -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE Natural2GlobalOrdering *giveN2Gmap() { return & n2g; } Natural2LocalOrdering *giveN2Lmap() { return & n2l; } #endif diff --git a/src/oofemlib/parallelordering.h b/src/oofemlib/parallelordering.h index cdf50f0a0..de5521495 100644 --- a/src/oofemlib/parallelordering.h +++ b/src/oofemlib/parallelordering.h @@ -35,7 +35,7 @@ #ifndef parallelordering_h #define parallelordering_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "intarray.h" #include "dofmanager.h" diff --git a/src/oofemlib/parser.C b/src/oofemlib/parser.C index d220f7fb1..164ea9d33 100644 --- a/src/oofemlib/parser.C +++ b/src/oofemlib/parser.C @@ -95,14 +95,12 @@ double Parser :: term(bool get) // multiply and divide break; } OOFEM_ERROR("divide by 0"); - return 1; case MOD: if ( ( d = prim(true) ) ) { left = fmod(left,d); break; } OOFEM_ERROR("divide by 0"); - return 1; case POW: left = pow( left, prim(true) ); break; @@ -146,7 +144,6 @@ double Parser :: prim(bool get) // handle primaries double e = expr(true); if ( curr_tok != RP ) { OOFEM_ERROR(") expected"); - return 1; } get_token(); // eat ')' @@ -214,7 +211,6 @@ double Parser :: prim(bool get) // handle primaries default: OOFEM_ERROR("primary expected"); - return 1; } } @@ -230,7 +226,6 @@ double Parser :: agr(bool get) double e = expr(true); if ( curr_tok != RP ) { OOFEM_ERROR(") expected"); - return 1; } get_token(); // eat ')' @@ -238,7 +233,6 @@ double Parser :: agr(bool get) } default: OOFEM_ERROR("function argument expected"); - return 1; } } @@ -359,7 +353,6 @@ Parser :: Token_value Parser :: get_token() } OOFEM_ERROR("bad token"); - return curr_tok = PRINT; } } diff --git a/src/oofemlib/parser.h b/src/oofemlib/parser.h index d5639dfe1..0cb951cf5 100644 --- a/src/oofemlib/parser.h +++ b/src/oofemlib/parser.h @@ -35,7 +35,7 @@ #ifndef parser_h #define parser_h -#include "oofemcfg.h" +#include "oofemenv.h" namespace oofem { #define Parser_CMD_LENGTH 1024 @@ -84,7 +84,7 @@ class OOFEM_EXPORT Parser double value; }; name *table [ Parser_TBLSZ ]; - double number_value; + double number_value =0.0; char string_value [ Parser_CMD_LENGTH ]; const char *parsedLine; diff --git a/src/oofemlib/petscsolver.C b/src/oofemlib/petscsolver.C index 1aae5de1e..4613ee221 100644 --- a/src/oofemlib/petscsolver.C +++ b/src/oofemlib/petscsolver.C @@ -104,7 +104,7 @@ PetscSolver :: petsc_solve(PetscSparseMtrx &Lhs, Vec b, Vec x) #pragma omp critical #endif if ( !Lhs.kspInit ) { -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE MPI_Comm comm = engngModel->giveParallelComm(); #else MPI_Comm comm = PETSC_COMM_SELF; diff --git a/src/oofemlib/petscsparsemtrx.C b/src/oofemlib/petscsparsemtrx.C index 34deaa682..4b4052953 100644 --- a/src/oofemlib/petscsparsemtrx.C +++ b/src/oofemlib/petscsparsemtrx.C @@ -505,7 +505,7 @@ PetscSparseMtrx :: buildInternalStructure(EngngModel *eModel, int di, const Unkn this->di = di; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( eModel->isParallel() ) { Natural2GlobalOrdering *n2g; Natural2LocalOrdering *n2l; @@ -741,7 +741,7 @@ PetscSparseMtrx :: assemble(const IntArray &loc, const FloatMatrix &mat) int ndofe = mat.giveNumberOfRows(); IntArray gloc(ndofe); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( emodel->isParallel() ) { // translate local code numbers to global ones emodel->giveParallelContext(this->di)->giveN2Gmap()->map2New(gloc, loc, 0); @@ -794,7 +794,7 @@ PetscSparseMtrx :: assemble(const IntArray &loc, const FloatMatrix &mat) int PetscSparseMtrx :: assemble(const IntArray &rloc, const IntArray &cloc, const FloatMatrix &mat) { -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( emodel->isParallel() ) { // translate eq numbers IntArray grloc( rloc.giveSize() ), gcloc( cloc.giveSize() ); @@ -818,7 +818,7 @@ PetscSparseMtrx :: assemble(const IntArray &rloc, const IntArray &cloc, const Fl MatSetValues(this->mtrx, rsize, grloc.givePointer(), csize, gcloc.givePointer(), mat.givePointer(), ADD_VALUES); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE } #endif // increment version @@ -885,7 +885,7 @@ PetscSparseMtrx :: at(int i, int j) const std::unique_ptr PetscSparseMtrx :: giveSubMatrix(const IntArray &rows, const IntArray &cols) { -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE auto comm = this->emodel->giveParallelComm(); #else auto comm = PETSC_COMM_SELF; @@ -950,7 +950,7 @@ void PetscSparseMtrx :: writeToFile(const char *fname) const { PetscViewer viewer; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE PetscViewerASCIIOpen(this->emodel->giveParallelComm(), fname, & viewer); #else PetscViewerASCIIOpen(PETSC_COMM_SELF, fname, & viewer); @@ -963,7 +963,7 @@ PetscSparseMtrx :: writeToFile(const char *fname) const void PetscSparseMtrx :: createVecGlobal(Vec *answer) const { -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( emodel->isParallel() ) { VecCreate(this->emodel->giveParallelComm(), answer); VecSetSizes(* answer, this->leqs, this->geqs); @@ -971,7 +971,7 @@ PetscSparseMtrx :: createVecGlobal(Vec *answer) const } else { #endif VecCreateSeq(PETSC_COMM_SELF, this->giveNumberOfRows(), answer); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE } #endif } @@ -982,7 +982,7 @@ PetscSparseMtrx :: scatterG2L(Vec src, FloatArray &dest) const { PetscScalar *ptr; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( emodel->isParallel() ) { ParallelContext *context = emodel->giveParallelContext(di); int neqs = context->giveNumberOfNaturalEqs(); @@ -1012,7 +1012,7 @@ PetscSparseMtrx :: scatterG2L(Vec src, FloatArray &dest) const dest.at(i + 1) = ptr [ i ]; } VecRestoreArray(src, & ptr); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE } #endif return 1; @@ -1024,7 +1024,7 @@ PetscSparseMtrx :: scatterL2G(const FloatArray &src, Vec dest) const { const PetscScalar *ptr = src.givePointer(); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( emodel->isParallel() ) { ParallelContext *context = this->emodel->giveParallelContext(di); int size = src.giveSize(); @@ -1051,7 +1051,7 @@ PetscSparseMtrx :: scatterL2G(const FloatArray &src, Vec dest) const VecAssemblyBegin(dest); VecAssemblyEnd(dest); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE } #endif return 1; diff --git a/src/oofemlib/prescribedgradientbcneumann.C b/src/oofemlib/prescribedgradientbcneumann.C index d7c37c67d..9f3e97958 100644 --- a/src/oofemlib/prescribedgradientbcneumann.C +++ b/src/oofemlib/prescribedgradientbcneumann.C @@ -357,10 +357,9 @@ void PrescribedGradientBCNeumann :: integrateTangent(FloatMatrix &oTangent, Elem if ( !interp2d ) { OOFEM_ERROR("failed to cast to FEInterpolation2d.") } - const auto &edgeNodes = interp2d->computeLocalEdgeMapping(iBndIndex); - -// const auto &xS = * ( e->giveDofManager( edgeNodes.at(1) )->giveCoordinates() ); -// const auto &xE = * ( e->giveDofManager( edgeNodes.at( edgeNodes.giveSize() ) )->giveCoordinates() ); + // const auto &edgeNodes = interp2d->computeLocalEdgeMapping(iBndIndex); + // const auto &xS = * ( e->giveDofManager( edgeNodes.at(1) )->giveCoordinates() ); + // const auto &xE = * ( e->giveDofManager( edgeNodes.at( edgeNodes.giveSize() ) )->giveCoordinates() ); std :: vector< Line >segments; std :: vector< FloatArray >intersecPoints; @@ -370,7 +369,7 @@ void PrescribedGradientBCNeumann :: integrateTangent(FloatMatrix &oTangent, Elem int numPointsPerSeg = 1; ir->SetUpPointsOnLine(numPointsPerSeg, matMode); } else { - ir = interp->giveBoundaryIntegrationRule(order, iBndIndex); + ir = interp->giveBoundaryIntegrationRule(order, iBndIndex, e->giveGeometryType()); } oTangent.clear(); diff --git a/src/oofemlib/prescribedgradientbcperiodic.C b/src/oofemlib/prescribedgradientbcperiodic.C index 7c9aa0e6c..6139e1eaa 100644 --- a/src/oofemlib/prescribedgradientbcperiodic.C +++ b/src/oofemlib/prescribedgradientbcperiodic.C @@ -352,7 +352,7 @@ double PrescribedGradientBCPeriodic :: giveBcValue(Dof *dof, ValueModeType mode, return this->mGradient( index % 3, index / 3 ) * this->giveTimeFunction()->evaluateAtTime(tStep->giveTargetTime());; } OOFEM_ERROR("Has no prescribed value from bc."); - return 0.0; + //return 0.0; } diff --git a/src/oofemlib/prescribedgradientbcweak.C b/src/oofemlib/prescribedgradientbcweak.C index a37e653db..3784acd23 100644 --- a/src/oofemlib/prescribedgradientbcweak.C +++ b/src/oofemlib/prescribedgradientbcweak.C @@ -146,7 +146,7 @@ DofManager *PrescribedGradientBCWeak :: giveInternalDofManager(int i) return mpTracElNew [ i - 1 ].mFirstNode.get(); } else { OOFEM_ERROR("return mpDisplacementLock") - return mpDisplacementLock.get(); + //return mpDisplacementLock.get(); } } @@ -1390,7 +1390,6 @@ void PrescribedGradientBCWeak :: createTractionMesh(bool iEnforceCornerPeriodici for ( auto & el : mpTracElNew ) { i = 0; - for ( auto &line : el.mInteriorSegments ) { FloatArray xS = line.giveVertex(1); xS.resizeWithValues(2); @@ -1821,7 +1820,7 @@ int PrescribedGradientBCWeak :: giveSideIndex(const FloatArray &iPos) const OOFEM_ERROR("Could not identify side index.") - return -1; + //return -1; } void PrescribedGradientBCWeak :: findHoleCoord(std::vector &oHoleCoordUnsorted, std::vector &oAllCoordUnsorted) @@ -1839,7 +1838,7 @@ void PrescribedGradientBCWeak :: findHoleCoord(std::vector &oHoleCoo int elIndex = boundaries.at(pos * 2 - 1); Element *e = this->giveDomain()->giveElement( elIndex ); int boundary = boundaries.at(pos * 2); - const auto &bNodes = e->giveInterpolation()->boundaryGiveNodes(boundary); + const auto &bNodes = e->giveInterpolation()->boundaryGiveNodes(boundary, e->giveGeometryType()); DofManager *startNode = e->giveDofManager(bNodes [ 0 ]); int startNodeInd = startNode->giveNumber(); DofManager *endNode = e->giveDofManager(bNodes [ 1 ]); @@ -1896,7 +1895,7 @@ void PrescribedGradientBCWeak :: findCrackBndIntersecCoord(std::vectorgiveDomain()->giveElement( boundaries.at(pos * 2 - 1) ); int boundary = boundaries.at(pos * 2); - const auto &bNodes = e->giveInterpolation()->boundaryGiveNodes(boundary); + const auto &bNodes = e->giveInterpolation()->boundaryGiveNodes(boundary, e->giveGeometryType()); // Add the start and end nodes of the segment DofManager *startNode = e->giveDofManager(bNodes [ 0 ]); diff --git a/src/oofemlib/prescribedgradientbcweak.h b/src/oofemlib/prescribedgradientbcweak.h index 32b074a3d..8e9dcc6dd 100644 --- a/src/oofemlib/prescribedgradientbcweak.h +++ b/src/oofemlib/prescribedgradientbcweak.h @@ -366,7 +366,7 @@ class ArcPosSortFunction3 } OOFEM_ERROR("Could not compute distance.") - return 0.0; + //return 0.0; } private: @@ -435,7 +435,7 @@ class ArcPosSortFunction4 } OOFEM_ERROR("Could not compute distance.") - return 0.0; + //return 0.0; } private: diff --git a/src/oofemlib/prescribedgradienthomogenization.h b/src/oofemlib/prescribedgradienthomogenization.h index 7802a4356..dc2abe4f1 100644 --- a/src/oofemlib/prescribedgradienthomogenization.h +++ b/src/oofemlib/prescribedgradienthomogenization.h @@ -74,7 +74,7 @@ class OOFEM_EXPORT PrescribedGradientHomogenization PrescribedGradientHomogenization() { } virtual ~PrescribedGradientHomogenization() { } - virtual double domainSize() { OOFEM_ERROR("Not implemented."); return 0.0; } + virtual double domainSize() { OOFEM_ERROR("Not implemented."); } /** * Initializes receiver according to object description stored in input record. diff --git a/src/oofemlib/prescribedmean.C b/src/oofemlib/prescribedmean.C index 9fdf166c4..257eb0ccb 100644 --- a/src/oofemlib/prescribedmean.C +++ b/src/oofemlib/prescribedmean.C @@ -95,8 +95,8 @@ PrescribedMean :: assemble(SparseMtrx &answer, TimeStep *tStep, CharType type, Element *thisElement = this->giveDomain()->giveElement(elementID); FEInterpolation *interpolator = thisElement->giveInterpolation(DofIDItem(dofid)); - auto iRule = (elementEdges) ? (interpolator->giveBoundaryIntegrationRule(3, sides.at(i))) : - (interpolator->giveIntegrationRule(3)); + auto iRule = (elementEdges) ? (interpolator->giveBoundaryIntegrationRule(3, sides.at(i), thisElement->giveGeometryType())) : + (interpolator->giveIntegrationRule(3, thisElement->giveGeometryType())); for ( GaussPoint * gp: * iRule ) { FloatArray lcoords = gp->giveNaturalCoordinates(); @@ -107,7 +107,7 @@ PrescribedMean :: assemble(SparseMtrx &answer, TimeStep *tStep, CharType type, if (elementEdges) { // Compute boundary integral - auto boundaryNodes = interpolator->boundaryGiveNodes(sides.at(i) ); + auto boundaryNodes = interpolator->boundaryGiveNodes(sides.at(i), thisElement->giveGeometryType() ); interpolator->boundaryEvalN(N, sides.at(i), lcoords, FEIElementGeometryWrapper(thisElement)); detJ = fabs ( interpolator->boundaryGiveTransformationJacobian(sides.at(i), lcoords, FEIElementGeometryWrapper(thisElement)) ); // Retrieve locations for dofs on boundary @@ -181,8 +181,8 @@ PrescribedMean :: giveInternalForcesVector(FloatArray &answer, TimeStep *tStep, FEInterpolation *interpolator = thisElement->giveInterpolation(DofIDItem(dofid)); auto iRule = elementEdges ? - interpolator->giveBoundaryIntegrationRule(3, sides.at(i)) : - interpolator->giveIntegrationRule(3); + interpolator->giveBoundaryIntegrationRule(3, sides.at(i), thisElement->giveGeometryType()) : + interpolator->giveIntegrationRule(3, thisElement->giveGeometryType()); for ( auto &gp: *iRule ) { FloatArray lcoords = gp->giveNaturalCoordinates(); @@ -192,7 +192,7 @@ PrescribedMean :: giveInternalForcesVector(FloatArray &answer, TimeStep *tStep, if (elementEdges) { // Compute integral - auto boundaryNodes = interpolator->boundaryGiveNodes(sides.at(i) ); + auto boundaryNodes = interpolator->boundaryGiveNodes(sides.at(i), thisElement->giveGeometryType() ); thisElement->computeBoundaryVectorOf(boundaryNodes, dofids, VM_Total, tStep, a); interpolator->boundaryEvalN(N, sides.at(i), lcoords, FEIElementGeometryWrapper(thisElement)); detJ = fabs ( interpolator->boundaryGiveTransformationJacobian(sides.at(i), lcoords, FEIElementGeometryWrapper(thisElement)) ); @@ -298,8 +298,8 @@ PrescribedMean :: computeDomainSize() FEInterpolation *interpolator = thisElement->giveInterpolation(DofIDItem(dofid)); auto iRule = elementEdges ? - interpolator->giveBoundaryIntegrationRule(3, sides.at(i)) : - interpolator->giveIntegrationRule(3); + interpolator->giveBoundaryIntegrationRule(3, sides.at(i), thisElement->giveGeometryType()) : + interpolator->giveIntegrationRule(3, thisElement->giveGeometryType()); for ( auto &gp: *iRule ) { FloatArray lcoords = gp->giveNaturalCoordinates(); diff --git a/src/oofemlib/primaryfield.C b/src/oofemlib/primaryfield.C index 4edc58768..e54611659 100644 --- a/src/oofemlib/primaryfield.C +++ b/src/oofemlib/primaryfield.C @@ -342,7 +342,7 @@ PrimaryField :: giveUnknownValue(Dof *dof, ValueModeType mode, TimeStep *tStep) OOFEM_ERROR("unsupported mode"); } - return 0.0; + // return 0.0; } int @@ -418,7 +418,6 @@ PrimaryField :: __evaluateAt(FloatArray &answer, const FloatArray &coords, } } else { OOFEM_ERROR("background element does not support EIPrimaryFiledInterface"); - return 1; // failed } #endif } @@ -475,7 +474,7 @@ PrimaryField :: resolveIndx(TimeStep *tStep, int shift) OOFEM_ERROR("History not available for relative step no. %d to step no. %d (actualStepNumber = %d)", shift, tStepo, actualStepNumber); } - return 0; + // return 0; } diff --git a/src/oofemlib/primaryunknownmapper.h b/src/oofemlib/primaryunknownmapper.h index e1ba2048f..593e08979 100644 --- a/src/oofemlib/primaryunknownmapper.h +++ b/src/oofemlib/primaryunknownmapper.h @@ -35,7 +35,7 @@ #ifndef primaryunknownmapper_h #define primaryunknownmapper_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "interface.h" #include "valuemodetype.h" diff --git a/src/oofemlib/processcomm.h b/src/oofemlib/processcomm.h index 49c103e86..8f211dbc6 100644 --- a/src/oofemlib/processcomm.h +++ b/src/oofemlib/processcomm.h @@ -35,7 +35,7 @@ #ifndef processcomm_h #define processcomm_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "combuff.h" #include "commbufftype.h" #include "communicatormode.h" @@ -73,26 +73,28 @@ class OOFEM_EXPORT ProcessCommunicatorBuff: public DataStream /// Constructor, creates empty send and receive com buffs in MPI_COMM_WORLD. ProcessCommunicatorBuff(CommBuffType t); - int givePackSizeOfInt(int count) override { return send_buff->givePackSizeOfInt(count); } - int givePackSizeOfDouble(int count) override { return send_buff->givePackSizeOfDouble(count); } - int givePackSizeOfChar(int count) override { return send_buff->givePackSizeOfChar(count); } - int givePackSizeOfBool(int count) override { return send_buff->givePackSizeOfBool(count); } - int givePackSizeOfLong(int count) override { return send_buff->givePackSizeOfLong(count); } + int givePackSizeOfInt(std::size_t count) override { return send_buff->givePackSizeOfInt(count); } + int givePackSizeOfDouble(std::size_t count) override { return send_buff->givePackSizeOfDouble(count); } + int givePackSizeOfChar(std::size_t count) override { return send_buff->givePackSizeOfChar(count); } + int givePackSizeOfBool(std::size_t count) override { return send_buff->givePackSizeOfBool(count); } + int givePackSizeOfLong(std::size_t count) override { return send_buff->givePackSizeOfLong(count); } + int givePackSizeOfSizet(std::size_t count) override { return send_buff->givePackSizeOfSizet(count); } + using DataStream::write; - int write(const int *data, int count) override { return send_buff->write(data, count); } - int write(const long *data, int count) override { return send_buff->write(data, count); } - int write(const unsigned long *data, int count) override { return send_buff->write(data, count); } - int write(const double *data, int count) override { return send_buff->write(data, count); } - int write(const char *data, int count) override { return send_buff->write(data, count); } + int write(const int *data, std::size_t count) override { return send_buff->write(data, count); } + int write(const long *data, std::size_t count) override { return send_buff->write(data, count); } + int write(const unsigned long *data, std::size_t count) override { return send_buff->write(data, count); } + int write(const double *data, std::size_t count) override { return send_buff->write(data, count); } + int write(const char *data, std::size_t count) override { return send_buff->write(data, count); } int write(bool data) override { return send_buff->write(data); } using DataStream::read; - int read(int *data, int count) override { return this->recv_buff->read(data, count); } - int read(long *data, int count) override { return this->recv_buff->read(data, count); } - int read(unsigned long *data, int count) override { return this->recv_buff->read(data, count); } - int read(double *data, int count) override { return this->recv_buff->read(data, count); } - int read(char *data, int count) override { return this->recv_buff->read(data, count); } + int read(int *data, std::size_t count) override { return this->recv_buff->read(data, count); } + int read(long *data, std::size_t count) override { return this->recv_buff->read(data, count); } + int read(unsigned long *data, std::size_t count) override { return this->recv_buff->read(data, count); } + int read(double *data, std::size_t count) override { return this->recv_buff->read(data, count); } + int read(char *data, std::size_t count) override { return this->recv_buff->read(data, count); } int read(bool &data) override { return recv_buff->read(data); } /// Initializes send buffer to empty state. All packed data are lost. @@ -146,8 +148,8 @@ class OOFEM_EXPORT ProcessCommunicatorBuff: public DataStream */ void clearBuffers() { } - void resizeSendBuffer(int size) { send_buff->resize(size); } - void resizeReceiveBuffer(int size) { recv_buff->resize(size); } + void resizeSendBuffer(std::size_t size) { send_buff->resize(size); } + void resizeReceiveBuffer(std::size_t size) { recv_buff->resize(size); } /**@name Methods for manipulating/testing receiver state */ //@{ diff --git a/src/oofemlib/range.h b/src/oofemlib/range.h index 0ca0a3ee9..0b0e3cb60 100644 --- a/src/oofemlib/range.h +++ b/src/oofemlib/range.h @@ -38,7 +38,7 @@ //#include #include -#include "oofemcfg.h" +#include "oofemenv.h" namespace oofem { /** diff --git a/src/oofemlib/remeshingcrit.C b/src/oofemlib/remeshingcrit.C index 1ecbfac25..8a582982b 100644 --- a/src/oofemlib/remeshingcrit.C +++ b/src/oofemlib/remeshingcrit.C @@ -35,7 +35,7 @@ #include "remeshingcrit.h" #include "errorestimator.h" -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE #include "problemcomm.h" #endif @@ -43,7 +43,7 @@ namespace oofem { RemeshingCriteria :: RemeshingCriteria(int n, ErrorEstimator *e) : FEMComponent( n, e->giveDomain() ) { ee = e; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE communicator = NULL; commBuff = NULL; initCommMap = true; @@ -52,7 +52,7 @@ RemeshingCriteria :: RemeshingCriteria(int n, ErrorEstimator *e) : FEMComponent( RemeshingCriteria :: ~RemeshingCriteria() { -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE delete communicator; delete commBuff; #endif diff --git a/src/oofemlib/remeshingcrit.h b/src/oofemlib/remeshingcrit.h index b018ed4c4..52ad8a114 100644 --- a/src/oofemlib/remeshingcrit.h +++ b/src/oofemlib/remeshingcrit.h @@ -63,7 +63,7 @@ class OOFEM_EXPORT RemeshingCriteria : public FEMComponent protected: ErrorEstimator *ee; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE /// Common Communicator buffer. CommunicatorBuff *commBuff; /// Communicator. diff --git a/src/oofemlib/rowcol.h b/src/oofemlib/rowcol.h index 7dddd8e06..458575ff6 100644 --- a/src/oofemlib/rowcol.h +++ b/src/oofemlib/rowcol.h @@ -35,7 +35,7 @@ #ifndef rowcol_h #define rowcol_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "vector" diff --git a/src/oofemlib/set.C b/src/oofemlib/set.C index 07439dcb8..c01f5038a 100644 --- a/src/oofemlib/set.C +++ b/src/oofemlib/set.C @@ -86,7 +86,9 @@ void Set :: initializeFrom(InputRecord &ir) this->elementInternalNodes.clear(); IR_GIVE_OPTIONAL_FIELD(ir, this->elementInternalNodes, _IFT_Set_internalElementNodes); - +#if 0 + this->inputRec = ir.clone(); +#endif } @@ -168,7 +170,7 @@ const IntArray &Set :: giveNodeList() auto e = this->domain->giveElement( this->elementBoundaries.at(ibnd * 2 - 1) ); auto boundary = this->elementBoundaries.at(ibnd * 2); auto fei = e->giveInterpolation(); - auto bNodes = fei->boundaryGiveNodes(boundary); + auto bNodes = fei->boundaryGiveNodes(boundary, e->giveGeometryType()); for ( int inode = 1; inode <= bNodes.giveSize(); ++inode ) { afflictedNodes.at( e->giveNode( bNodes.at(inode) )->giveNumber() ) = 1; } @@ -178,7 +180,7 @@ const IntArray &Set :: giveNodeList() auto e = this->domain->giveElement( this->elementEdges.at(iedge * 2 - 1) ); auto edge = this->elementEdges.at(iedge * 2); auto fei = e->giveInterpolation(); - auto eNodes = fei->boundaryEdgeGiveNodes(edge); + auto eNodes = fei->boundaryEdgeGiveNodes(edge, e->giveGeometryType()); for ( int inode = 1; inode <= eNodes.giveSize(); ++inode ) { afflictedNodes.at( e->giveNode( eNodes.at(inode) )->giveNumber() ) = 1; } @@ -188,7 +190,7 @@ const IntArray &Set :: giveNodeList() auto e = this->domain->giveElement( this->elementSurfaces.at(isurf * 2 - 1) ); auto surf = this->elementSurfaces.at(isurf * 2); auto fei = e->giveInterpolation(); - auto eNodes = fei->boundarySurfaceGiveNodes(surf); + auto eNodes = fei->boundarySurfaceGiveNodes(surf, e->giveGeometryType()); for ( int inode = 1; inode <= eNodes.giveSize(); ++inode ) { afflictedNodes.at( e->giveNode( eNodes.at(inode) )->giveNumber() ) = 1; } @@ -246,23 +248,65 @@ void Set :: updateLocalNumbering(EntityRenumberingFunctor &f) void Set :: updateLocalNodeNumbering(EntityRenumberingFunctor &f) { + int localNum; + IntArray mappedNumbers; + for ( int i = 1; i <= nodes.giveSize(); i++ ) { - nodes.at(i) = f(nodes.at(i), ERS_DofManager); + try { + localNum = f(nodes.at(i), ERS_DofManager); + } catch ( std :: out_of_range &e ) { +//#ifndef __MPI_PARALLEL_MODE + OOFEM_WARNING("Set :: updateLocalNodeNumbering - Node %d not found", nodes.at(i)); +//#endif + continue; + } + mappedNumbers.followedBy(localNum,10); } + nodes = mappedNumbers; } void Set :: updateLocalElementNumbering(EntityRenumberingFunctor &f) { + int localNum; + IntArray mappedNumbers; for ( int i = 1; i <= elements.giveSize(); i++ ) { - elements.at(i) = f(elements.at(i), ERS_Element); + try { + localNum = f(elements.at(i), ERS_Element); + } catch ( std :: out_of_range &e ) { +//#ifndef __MPI_PARALLEL_MODE + OOFEM_WARNING("Set :: updateLocalElementNumbering - Element %d with indx %d not found", elements.at(i), i); +//#endif + continue; + } + mappedNumbers.followedBy(localNum,10); } + elements = mappedNumbers; + ///@todo Check order of element number and boundary number (same for edges) + mappedNumbers.resize(0); for ( int i = 1; i <= elementBoundaries.giveSize(); i += 2 ) { - elementBoundaries.at(i) = f(elementBoundaries.at(i), ERS_Element); + try { + localNum = f(elementBoundaries.at(i), ERS_Element); + } catch ( std :: out_of_range &e ) { + continue; + } + mappedNumbers.followedBy(localNum,10); + mappedNumbers.followedBy(elementBoundaries.at(i+1)); } + elementBoundaries = mappedNumbers; + + mappedNumbers.resize(0); for ( int i = 1; i <= elementEdges.giveSize(); i += 2 ) { - elementEdges.at(i) = f(elementEdges.at(i), ERS_Element); + try { + localNum = f(elementEdges.at(i), ERS_Element); + } catch ( std :: out_of_range &e ) { + continue; + } + mappedNumbers.followedBy(localNum,10); + mappedNumbers.followedBy(elementEdges.at(i+1)); } + elementEdges = mappedNumbers; + for ( int i = 1; i <= this->elementInternalNodes.giveSize(); i += 2 ) { elementInternalNodes.at(i) = f(elementInternalNodes.at(i), ERS_Element); } diff --git a/src/oofemlib/set.h b/src/oofemlib/set.h index c2523a0eb..97309f490 100644 --- a/src/oofemlib/set.h +++ b/src/oofemlib/set.h @@ -62,6 +62,14 @@ class Range; /** * Set of elements, boundaries, edges and/or nodes. * Describes a collection of components which are given easy access to for example boundary conditions. + * + * @note bp: sets are defined using component labels (global numbers). In the initialization, the sets are resolved to local component numbers. + * In parallel mode (MPI), the sets are resolved to local component numbers on each processor, but set definition is TYPICALLY duplicated on all processors. + * In turn, the sets are resolved to local component numbers on each processor. As the set definition can contain global component, + * hat are not present on the processor, these entries are removed from the set during resolution process. + * To support also dynamic load balancing, the set resolution has to be done after each load balancing step and thus we need to keep the original set definition. + * This can be achieved by keeping the original input record of the set. + * * @author Mikael Öhman */ class OOFEM_EXPORT Set : public FEMComponent @@ -76,7 +84,10 @@ class OOFEM_EXPORT Set : public FEMComponent IntArray elementInternalNodes; /// Element numbers + internal dof manager numbers (interleaved). IntArray nodes; ///< Node numbers. IntArray totalNodes; ///< Unique set of nodes (computed). - +#if 0 + /// receiver original input record + std::unique_ptr inputRec; +#endif public: /** * Creates a empty set with given number and belonging to given domain. diff --git a/src/oofemlib/skyline.C b/src/oofemlib/skyline.C index 254065f57..36c158dc0 100644 --- a/src/oofemlib/skyline.C +++ b/src/oofemlib/skyline.C @@ -47,7 +47,9 @@ #include "contact/contactdefinition.h" #include "contact/contactelement.h" #include "unknownnumberingscheme.h" - +#ifdef __MPM_MODULE +#include "../mpm/integral.h" +#endif #include #include @@ -375,6 +377,28 @@ int Skyline :: buildInternalStructure(EngngModel *eModel, int di, const UnknownN } } +#ifdef __MPM_MODULE + IntArray locr, locc; + // loop over integrals + for (auto &in: eModel->giveIntegralList()) { + // loop over integral domain + for (auto &elem: in->set.giveElementList()) { + // get code numbers for integral.term on element + in->getElementTermCodeNumbers (locr, locc, domain->giveElement(elem), in->term, s) ; + maxle = INT_MAX; + for ( int ii : locr ) { + if ( ii > 0 ) { + maxle = min(maxle, ii); + } + } + for ( int jj : locc ) { + if ( jj > 0 ) { + mht.at(jj) = min( maxle, mht.at(jj) ); + } + } + } + } +#endif if ( domain->hasContactManager() ) { ContactManager *cMan = domain->giveContactManager(); @@ -724,9 +748,9 @@ void Skyline :: rbmodes(FloatMatrix &r, int &nse, IntArray &se, adrb.at(ise) = ib; /* vynulovani prvku radku v poli a */ - for ( int j = i + 1; j <= neq; j++ ) { - if ( j - ( adr.at(j + 1) - adr.at(j) ) < i ) { - mtrx [ adr.at(j) + j - i ] = 0.0; + for ( int jj = i + 1; jj <= neq; jj++ ) { + if ( jj - ( adr.at(jj + 1) - adr.at(jj) ) < i ) { + mtrx [ adr.at(jj) + jj - i ] = 0.0; } } } diff --git a/src/oofemlib/slavedof.C b/src/oofemlib/slavedof.C index abd95a05c..6af4058c6 100644 --- a/src/oofemlib/slavedof.C +++ b/src/oofemlib/slavedof.C @@ -78,6 +78,19 @@ SlaveDof :: initialize(const IntArray &masterNodes, const IntArray &mstrDofID, c masterDofMans.at(i) = masterNodes.at(i); dofIDs.at(i) = id; } + //// Handle rotational DOF (Rv) case + //if ( this->dofID == R_v ) { + // double y1 = getYCoordinate( masterNodes.at( 1 ) ); // Get y-coordinates of master nodes + // double y3 = getYCoordinate( masterNodes.at( 2 ) ); + + // if ( fabs( y3 - y1 ) < 1e-12 ) { + // OOFEM_ERROR( "Master nodes are too close, division by zero in Rv calculation." ); + // } + + // masterContribution.resize( 2 ); + // masterContribution.at( 1 ) = -1.0 / ( y3 - y1 ); + // masterContribution.at( 2 ) = 1.0 / ( y3 - y1 ); + //} } int @@ -202,14 +215,12 @@ double SlaveDof :: giveUnknown(PrimaryField &field, ValueModeType mode, TimeStep int SlaveDof :: __giveEquationNumber() const { OOFEM_ERROR("undefined"); - return 0; } int SlaveDof :: __givePrescribedEquationNumber() { OOFEM_ERROR("undefined"); - return 0; } void SlaveDof :: saveContext(DataStream &stream, ContextMode mode) @@ -286,7 +297,12 @@ void SlaveDof :: restoreContext(DataStream &stream, ContextMode mode) inline Dof * SlaveDof :: giveMasterDof(int i) { - return dofManager->giveDomain()->giveDofManager( masterDofMans.at(i) )->giveDofWithID( dofIDs.at(i) ); + if ( dofIDs.at( i ) <= 3 ) { + return dofManager->giveDomain()->giveDofManager( masterDofMans.at( i ) )->giveDofWithID( dofIDs.at( i ) ); + } else { + //return nullptr; + return dofManager->giveDomain()->giveDofManager( masterDofMans.at( i ) )->giveDofWithID( 1 ); + } } diff --git a/src/oofemlib/slepcsolver.C b/src/oofemlib/slepcsolver.C index 0d10c20d0..1dfd1b353 100644 --- a/src/oofemlib/slepcsolver.C +++ b/src/oofemlib/slepcsolver.C @@ -108,7 +108,7 @@ SLEPcSolver :: solve(SparseMtrx &a, SparseMtrx &b, FloatArray &_eigv, FloatMatri /* * Create eigensolver context */ -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE MPI_Comm comm = engngModel->giveParallelComm(); #else MPI_Comm comm = PETSC_COMM_SELF; diff --git a/src/oofemlib/sloangraph.h b/src/oofemlib/sloangraph.h index ea61c0255..43a08dd22 100644 --- a/src/oofemlib/sloangraph.h +++ b/src/oofemlib/sloangraph.h @@ -35,7 +35,7 @@ #ifndef sloangraph_h #define sloangraph_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "sloangraphnode.h" #include "sloanlevelstruct.h" #include "dofmanager.h" diff --git a/src/oofemlib/sloangraphnode.h b/src/oofemlib/sloangraphnode.h index be93c201e..7556a07ce 100644 --- a/src/oofemlib/sloangraphnode.h +++ b/src/oofemlib/sloangraphnode.h @@ -37,7 +37,7 @@ #include -#include "oofemcfg.h" +#include "oofemenv.h" namespace oofem { class SloanGraph; diff --git a/src/oofemlib/sloanlevelstruct.C b/src/oofemlib/sloanlevelstruct.C index 132a08a7b..41b10e4b2 100644 --- a/src/oofemlib/sloanlevelstruct.C +++ b/src/oofemlib/sloanlevelstruct.C @@ -96,7 +96,7 @@ void SloanLevelStructure :: computeDepth() { this->formYourself(); - Depth = Structure.size(); + Depth = (int) Structure.size(); } void diff --git a/src/oofemlib/sloanlevelstruct.h b/src/oofemlib/sloanlevelstruct.h index ff246f655..b983c160d 100644 --- a/src/oofemlib/sloanlevelstruct.h +++ b/src/oofemlib/sloanlevelstruct.h @@ -35,7 +35,7 @@ #ifndef sloanlevelstruct_h #define sloanlevelstruct_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "intarray.h" namespace oofem { diff --git a/src/oofemlib/solutionbasedshapefunction.C b/src/oofemlib/solutionbasedshapefunction.C index 644afaf1e..cbc6b310d 100644 --- a/src/oofemlib/solutionbasedshapefunction.C +++ b/src/oofemlib/solutionbasedshapefunction.C @@ -159,7 +159,7 @@ SolutionbasedShapeFunction :: computeCorrectionFactors(modeStruct &myMode, IntAr IntArray zNodes, pNodes, mNodes; FloatMatrix nodeValues; - auto bnodes = geoInterpolation->boundaryGiveNodes(Boundary); + auto bnodes = geoInterpolation->boundaryGiveNodes(Boundary, thisElement->giveGeometryType() ); nodeValues.resize( this->dofs.giveSize(), bnodes.giveSize() ); nodeValues.zero(); @@ -167,7 +167,7 @@ SolutionbasedShapeFunction :: computeCorrectionFactors(modeStruct &myMode, IntAr // Change to global ID for bnodes and identify the intersection of bnodes and the zero boundary splitBoundaryNodeIDs(myMode, * thisElement, bnodes, pNodes, mNodes, zNodes, nodeValues); - std :: unique_ptr< IntegrationRule >iRule(geoInterpolation->giveBoundaryIntegrationRule(order, Boundary)); + std :: unique_ptr< IntegrationRule >iRule(geoInterpolation->giveBoundaryIntegrationRule(order, Boundary, thisElement->giveGeometryType())); for ( auto &gp: *iRule ) { const FloatArray &lcoords = gp->giveNaturalCoordinates(); @@ -646,7 +646,7 @@ SolutionbasedShapeFunction :: initializeSurfaceData(modeStruct &mode) #define usePoints 1 #if usePoints == 1 // Check if all nodes are on the boundary - auto bnodes = geoInterpolation->boundaryGiveNodes(Boundary); + auto bnodes = geoInterpolation->boundaryGiveNodes(Boundary, e->giveGeometryType()); for ( int k = 1; k <= bnodes.giveSize(); k++ ) { DofManager *dman = e->giveDofManager( bnodes.at(k) ); for ( int l = 1; l <= dman->giveCoordinates().giveSize(); l++ ) { diff --git a/src/oofemlib/solutionstatusexportmodule.C b/src/oofemlib/solutionstatusexportmodule.C index 82ea83f40..e84e98fa0 100644 --- a/src/oofemlib/solutionstatusexportmodule.C +++ b/src/oofemlib/solutionstatusexportmodule.C @@ -33,6 +33,7 @@ */ #include "solutionstatusexportmodule.h" +#include "oofemcfg.h" #include "engngm.h" #include "timestep.h" #include "classfactory.h" diff --git a/src/oofemlib/sparsemtrx.h b/src/oofemlib/sparsemtrx.h index b9799bb44..d730b4352 100644 --- a/src/oofemlib/sparsemtrx.h +++ b/src/oofemlib/sparsemtrx.h @@ -35,7 +35,7 @@ #ifndef sparsemtrx_h #define sparsemtrx_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "floatarray.h" #include "floatmatrix.h" #include "intarray.h" @@ -127,7 +127,6 @@ class OOFEM_EXPORT SparseMtrx virtual std::unique_ptr clone() const { OOFEM_ERROR("Not implemented"); - return nullptr; } /** @@ -209,7 +208,6 @@ class OOFEM_EXPORT SparseMtrx virtual int buildInternalStructure(EngngModel *eModel, int di, const UnknownNumberingScheme &r_s, const UnknownNumberingScheme &c_s) { OOFEM_ERROR("Not implemented"); - return 0; } /** * Assembles sparse matrix from contribution of local elements. This method for @@ -258,11 +256,10 @@ class OOFEM_EXPORT SparseMtrx /// Returns the norm of receiver. virtual double computeNorm() const { OOFEM_ERROR("Not implemented"); - return 0.0; } virtual std::unique_ptr giveSubMatrix(const IntArray &rows, const IntArray &cols) - { OOFEM_ERROR("Not implemented"); return nullptr; } + { OOFEM_ERROR("Not implemented"); } /// Returns coefficient at position (i,j). virtual double &at(int i, int j) = 0; diff --git a/src/oofemlib/spatiallocalizer.h b/src/oofemlib/spatiallocalizer.h index 061c1b9be..0c5effb8e 100644 --- a/src/oofemlib/spatiallocalizer.h +++ b/src/oofemlib/spatiallocalizer.h @@ -35,7 +35,7 @@ #ifndef spatiallocalizer_h #define spatiallocalizer_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "interface.h" #include "logger.h" #include "error.h" diff --git a/src/oofemlib/sprnodalrecoverymodel.C b/src/oofemlib/sprnodalrecoverymodel.C index e4d829f70..eb90b1a73 100644 --- a/src/oofemlib/sprnodalrecoverymodel.C +++ b/src/oofemlib/sprnodalrecoverymodel.C @@ -42,7 +42,7 @@ #include "engngm.h" #include "classfactory.h" -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE #include "processcomm.h" #include "problemcomm.h" #endif @@ -73,7 +73,7 @@ SPRNodalRecoveryModel :: recoverValues(Set elementSet, InternalStateType type, T return 1; } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE this->initCommMaps(); #endif @@ -114,7 +114,7 @@ SPRNodalRecoveryModel :: recoverValues(Set elementSet, InternalStateType type, T dofManToDetermine, a, regType); } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE this->exchangeDofManValues(dofManValues, dofManPatchCount, regionNodalNumbers, regionValSize); #endif @@ -606,17 +606,17 @@ SPRPatchType SPRNodalRecoveryModel :: determinePatchType(Set &elementList) } else { OOFEM_ERROR("empty region set"); } - return SPRPatchType_none; // to make compiler happy + // return SPRPatchType_none; // to make compiler happy } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE void SPRNodalRecoveryModel :: initCommMaps() { - #ifdef __PARALLEL_MODE + #ifdef __MPI_PARALLEL_MODE if ( initCommMap ) { EngngModel *emodel = domain->giveEngngModel(); commBuff = new CommunicatorBuff(emodel->giveNumberOfProcesses(), CBT_dynamic); diff --git a/src/oofemlib/sprnodalrecoverymodel.h b/src/oofemlib/sprnodalrecoverymodel.h index a7edfee1e..6c7663e78 100644 --- a/src/oofemlib/sprnodalrecoverymodel.h +++ b/src/oofemlib/sprnodalrecoverymodel.h @@ -107,7 +107,7 @@ class OOFEM_EXPORT SPRNodalRecoveryModel : public NodalRecoveryModel int giveNumberOfUnknownPolynomialCoefficients(SPRPatchType regType); SPRPatchType determinePatchType(Set &elementList); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE void initCommMaps(); void exchangeDofManValues(FloatArray &dofManValues, IntArray &dofManPatchCount, IntArray ®ionNodalNumbers, diff --git a/src/oofemlib/staggeredproblem.C b/src/oofemlib/staggeredproblem.C index 1d8ad0aac..5c56bc344 100644 --- a/src/oofemlib/staggeredproblem.C +++ b/src/oofemlib/staggeredproblem.C @@ -33,6 +33,7 @@ */ #include "staggeredproblem.h" +#include "oofemcfg.h" #include "engngm.h" #include "timestep.h" #include "function.h" @@ -209,7 +210,7 @@ StaggeredProblem :: initializeFrom(InputRecord &ir) fprintf(outputStream, "\nStarting analysis on: %s\n", ctime(& this->startTime) ); fprintf(outputStream, "%s\n", simulationDescription.c_str()); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( this->isParallel() ) { fprintf(outputStream, "Problem rank is %d/%d on %s\n\n", this->rank, this->numProcs, this->processor_name); } @@ -326,7 +327,6 @@ StaggeredProblem :: giveDiscreteTime(int iStep) } OOFEM_ERROR("invalid iStep"); - return 0.0; } TimeStep * @@ -473,7 +473,7 @@ StaggeredProblem :: solveYourself() sp->giveCurrentStep()->giveNumber(), _steptime); } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( loadBalancingFlag ) { this->balanceLoad( sp->giveCurrentStep() ); } @@ -581,7 +581,7 @@ StaggeredProblem :: giveSlaveProblem(int i) OOFEM_ERROR("Undefined problem"); } - return NULL; + // return NULL; } diff --git a/src/oofemlib/subdivision.C b/src/oofemlib/subdivision.C index 38dc8eb30..84e883fd6 100644 --- a/src/oofemlib/subdivision.C +++ b/src/oofemlib/subdivision.C @@ -59,7 +59,7 @@ #include "oofeggraphiccontext.h" #endif -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE #include "parallel.h" #include "problemcomm.h" #include "communicator.h" @@ -117,7 +117,7 @@ int Subdivision :: RS_Node :: buildTopLevelNodeConnectivity(ConnectivityTable *c for ( int el : connElems ) { -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( this->mesh->giveElement(el)->giveParallelMode() != Element_local ) { continue; } @@ -150,7 +150,7 @@ void Subdivision :: RS_Element :: buildTopLevelNodeConnectivity(Subdivision :: R } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE int Subdivision :: RS_Node :: importConnectivity(ConnectivityTable *ct) @@ -477,7 +477,7 @@ Subdivision :: RS_Tetra :: evaluateLongestEdge() // array ed contains edge numbers (1 to 6) connecting the node with each node (1 to 4) // (indexing from 1, zero means, that node is not connected by an edge with itself) int ed [ 4 ] [ 4 ] = { { 0, 1, 3, 4 }, { 1, 0, 2, 5 }, { 3, 2, 0, 6 }, { 4, 5, 6, 0 } }; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE int g_nd [ 4 ]; #endif bool swap; @@ -485,7 +485,7 @@ Subdivision :: RS_Tetra :: evaluateLongestEdge() // sort node ids for ( i = 0; i < 4; i++ ) { l_nd [ i ] = nodes.at(i + 1); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE g_nd [ i ] = mesh->giveNode(l_nd [ i ])->giveGlobalNumber(); #endif } @@ -494,13 +494,13 @@ Subdivision :: RS_Tetra :: evaluateLongestEdge() while ( swap ) { swap = false; for ( i = 0; i < 3; i++ ) { -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( g_nd [ i ] > g_nd [ i + 1 ] ) { #else if ( l_nd [ i ] > l_nd [ i + 1 ] ) { #endif int tmp; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE tmp = g_nd [ i ]; g_nd [ i ] = g_nd [ i + 1 ]; g_nd [ i + 1 ] = tmp; @@ -580,7 +580,6 @@ Subdivision :: RS_Triangle :: giveEdgeIndex(int iNode, int jNode) if ( in == 0 || jn == 0 ) { OOFEM_ERROR( "there is no edge connecting %d and %d on element %d", iNode, jNode, this->giveNumber() ); - return 0; } if ( in < jn ) { @@ -619,7 +618,6 @@ Subdivision :: RS_Tetra :: giveEdgeIndex(int iNode, int jNode) if ( in == 0 || jn == 0 ) { OOFEM_ERROR( "there is no edge connecting %d and %d on element %d", iNode, jNode, this->giveNumber() ); - return 0; } if ( in < jn ) { @@ -655,7 +653,7 @@ Subdivision :: RS_Triangle :: bisect(std :: queue< int > &subdivqueue, std :: li bool boundary = false; FloatArray coords; Subdivision :: RS_Element *elem; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE Subdivision :: RS_SharedEdge *edge; #endif @@ -688,7 +686,7 @@ Subdivision :: RS_Triangle :: bisect(std :: queue< int > &subdivqueue, std :: li #endif #endif -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE #ifdef __VERBOSE_PARALLEL OOFEM_LOG_INFO("[%d] RS_Triangle::bisecting %d nodes %d %d %d, leIndex %d, new irregular %d\n", mesh->giveSubdivision()->giveRank(), this->number, nodes.at(1), nodes.at(2), nodes.at(3), leIndex, iNum); #endif @@ -738,7 +736,7 @@ Subdivision :: RS_Triangle :: bisect(std :: queue< int > &subdivqueue, std :: li } } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE else { // check if there are (potentionally) shared edges if ( shared_edges.giveSize() ) { @@ -794,7 +792,7 @@ Subdivision :: RS_Tetra :: bisect(std :: queue< int > &subdivqueue, std :: list< Domain *dorig; RS_IrregularNode *irregular; const IntArray *iElems, *jElems; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE Subdivision :: RS_SharedEdge *edge; #endif @@ -955,7 +953,7 @@ Subdivision :: RS_Tetra :: bisect(std :: queue< int > &subdivqueue, std :: list< #endif #ifdef DEBUG_INFO - #ifdef __PARALLEL_MODE + #ifdef __MPI_PARALLEL_MODE // do not print global numbers of elements because they are not available (they are assigned at once after bisection); // do not print global numbers of irregulars as these may not be available yet OOFEM_LOG_INFO( "[%d] Irregular %d added on %d [%d] (edge %d, nodes %d %d [%d %d], nds %d %d %d %d [%d %d %d %d], ngbs %d %d %d %d, irr %d %d %d %d %d %d)\n", @@ -981,7 +979,7 @@ Subdivision :: RS_Tetra :: bisect(std :: queue< int > &subdivqueue, std :: list< shared = boundary = false; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE // check if there are (potentionally) shared edges if ( shared_edges.giveSize() ) { // check if the edge is (really) shared @@ -1054,7 +1052,7 @@ Subdivision :: RS_Tetra :: bisect(std :: queue< int > &subdivqueue, std :: list< } #ifdef DEBUG_INFO - #ifdef __PARALLEL_MODE + #ifdef __MPI_PARALLEL_MODE // do not print global numbers of elements because they are not available (they are assigned at once after bisection); // do not print global numbers of irregulars as these may not be available yet OOFEM_LOG_INFO( "[%d] Irregular %d added on %d [%d] (edge %d, nodes %d %d [%d %d], nds %d %d %d %d [%d %d %d %d], ngbs %d %d %d %d, irr %d %d %d %d %d %d)\n", @@ -1127,7 +1125,7 @@ Subdivision :: RS_Tetra :: bisect(std :: queue< int > &subdivqueue, std :: list< #endif #ifdef DEBUG_INFO - #ifdef __PARALLEL_MODE + #ifdef __MPI_PARALLEL_MODE // do not print global numbers of elements because they are not available (they are assigned at once after bisection); // do not print global numbers of irregulars as these may not be available yet OOFEM_LOG_INFO( "[%d] Irregular %d added on %d [%d] (edge %d, nodes %d %d [%d %d], nds %d %d %d %d [%d %d %d %d], ngbs %d %d %d %d, irr %d %d %d %d %d %d)\n", @@ -1232,7 +1230,7 @@ Subdivision :: RS_Tetra :: bisect(std :: queue< int > &subdivqueue, std :: list< elem->setIrregular(eInd, iNum); #ifdef DEBUG_INFO - #ifdef __PARALLEL_MODE + #ifdef __MPI_PARALLEL_MODE // do not print global numbers of elements because they are not available (they are assigned at once after bisection); // do not print global numbers of irregulars as these may not be available yet OOFEM_LOG_INFO( "[%d] Irregular %d added on %d [%d] (edge %d, nodes %d %d [%d %d], nds %d %d %d %d [%d %d %d %d], ngbs %d %d %d %d, irr %d %d %d %d %d %d)\n", @@ -1299,7 +1297,7 @@ Subdivision :: RS_Triangle :: generate(std :: list< int > &sharedEdgesQueue) IntArray _nodes(3); Subdivision :: RS_Triangle *child; Subdivision :: RS_Element *ngb; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE bool ishared = false, jshared = false, kshared = false; #endif @@ -1332,7 +1330,7 @@ Subdivision :: RS_Triangle :: generate(std :: list< int > &sharedEdgesQueue) jnode = ( inode < 3 ) ? inode + 1 : 1; knode = ( jnode < 3 ) ? jnode + 1 : 1; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( shared_edges.giveSize() ) { if ( shared_edges.at(iedge) ) { ishared = true; @@ -1361,7 +1359,7 @@ Subdivision :: RS_Triangle :: generate(std :: list< int > &sharedEdgesQueue) child->setNeighbor( 1, -this->giveNeighbor(kedge) ); child->setNeighbor(2, childNum + 2); child->setNeighbor(3, childNum + 1); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE // set shared info if ( kshared ) { child->makeSharedEdges(); @@ -1381,7 +1379,7 @@ Subdivision :: RS_Triangle :: generate(std :: list< int > &sharedEdgesQueue) child->setNeighbor(1, childNum - 1); child->setNeighbor(2, childNum + 2); child->setNeighbor( 3, -this->giveNeighbor(jedge) ); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE // set shared info if ( jshared ) { child->makeSharedEdges(); @@ -1401,7 +1399,7 @@ Subdivision :: RS_Triangle :: generate(std :: list< int > &sharedEdgesQueue) child->setNeighbor( 1, -this->giveNeighbor(iedge) ); child->setNeighbor(2, childNum - 2); child->setNeighbor( 3, -this->giveNeighbor(kedge) ); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE // set shared info if ( ishared || kshared ) { child->makeSharedEdges(); @@ -1428,7 +1426,7 @@ Subdivision :: RS_Triangle :: generate(std :: list< int > &sharedEdgesQueue) child->setNeighbor(2, childNum - 2); child->setNeighbor( 3, -this->giveNeighbor(iedge) ); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE // set shared info if ( ishared || jshared ) { child->makeSharedEdges(); @@ -1443,7 +1441,7 @@ Subdivision :: RS_Triangle :: generate(std :: list< int > &sharedEdgesQueue) #endif -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE // set connected elements if ( mesh->giveNode( nodes.at(inode) )->giveParallelMode() == DofManager_shared ) { mesh->giveNode( nodes.at(inode) )->eraseConnectedElement( this->giveNumber() ); @@ -1491,7 +1489,7 @@ Subdivision :: RS_Triangle :: generate(std :: list< int > &sharedEdgesQueue) child->setNeighbor( 1, -this->giveNeighbor(kedge) ); child->setNeighbor( 2, -this->giveNeighbor(iedge) ); child->setNeighbor(3, childNum + 1); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE // set shared info if ( ishared || kshared ) { child->makeSharedEdges(); @@ -1517,7 +1515,7 @@ Subdivision :: RS_Triangle :: generate(std :: list< int > &sharedEdgesQueue) child->setNeighbor(1, childNum - 1); child->setNeighbor(2, childNum + 1); child->setNeighbor( 3, -this->giveNeighbor(jedge) ); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE // set shared info if ( jshared ) { child->makeSharedEdges(); @@ -1537,7 +1535,7 @@ Subdivision :: RS_Triangle :: generate(std :: list< int > &sharedEdgesQueue) child->setNeighbor( 1, -this->giveNeighbor(jedge) ); child->setNeighbor(2, childNum - 1); child->setNeighbor( 3, -this->giveNeighbor(iedge) ); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE // set shared info if ( ishared || jshared ) { child->makeSharedEdges(); @@ -1552,7 +1550,7 @@ Subdivision :: RS_Triangle :: generate(std :: list< int > &sharedEdgesQueue) #endif -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE // set connected elements if ( mesh->giveNode( nodes.at(inode) )->giveParallelMode() == DofManager_shared ) { mesh->giveNode( nodes.at(inode) )->eraseConnectedElement( this->giveNumber() ); @@ -1594,7 +1592,7 @@ Subdivision :: RS_Triangle :: generate(std :: list< int > &sharedEdgesQueue) child->setNeighbor( 1, -this->giveNeighbor(kedge) ); child->setNeighbor(2, childNum + 1); child->setNeighbor(3, childNum + 2); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE // set shared info if ( kshared ) { child->makeSharedEdges(); @@ -1614,7 +1612,7 @@ Subdivision :: RS_Triangle :: generate(std :: list< int > &sharedEdgesQueue) child->setNeighbor( 1, -this->giveNeighbor(iedge) ); child->setNeighbor(2, childNum - 1); child->setNeighbor( 3, -this->giveNeighbor(kedge) ); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE // set shared info if ( ishared || kshared ) { child->makeSharedEdges(); @@ -1640,7 +1638,7 @@ Subdivision :: RS_Triangle :: generate(std :: list< int > &sharedEdgesQueue) child->setNeighbor(1, childNum - 2); child->setNeighbor( 2, -this->giveNeighbor(iedge) ); child->setNeighbor( 3, -this->giveNeighbor(jedge) ); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE // set shared info if ( ishared || jshared ) { child->makeSharedEdges(); @@ -1655,7 +1653,7 @@ Subdivision :: RS_Triangle :: generate(std :: list< int > &sharedEdgesQueue) #endif -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE // set connected elements if ( mesh->giveNode( nodes.at(inode) )->giveParallelMode() == DofManager_shared ) { mesh->giveNode( nodes.at(inode) )->eraseConnectedElement( this->giveNumber() ); @@ -1697,7 +1695,7 @@ Subdivision :: RS_Triangle :: generate(std :: list< int > &sharedEdgesQueue) child->setNeighbor( 1, -this->giveNeighbor(kedge) ); child->setNeighbor( 2, -this->giveNeighbor(iedge) ); child->setNeighbor(3, childNum + 1); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE // set shared info if ( ishared || kshared ) { child->makeSharedEdges(); @@ -1723,7 +1721,7 @@ Subdivision :: RS_Triangle :: generate(std :: list< int > &sharedEdgesQueue) child->setNeighbor(1, childNum - 1); child->setNeighbor( 2, -this->giveNeighbor(iedge) ); child->setNeighbor( 3, -this->giveNeighbor(jedge) ); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE // set shared info if ( ishared || jshared ) { child->makeSharedEdges(); @@ -1738,7 +1736,7 @@ Subdivision :: RS_Triangle :: generate(std :: list< int > &sharedEdgesQueue) #endif -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE // set connected elements if ( mesh->giveNode( nodes.at(inode) )->giveParallelMode() == DofManager_shared ) { mesh->giveNode( nodes.at(inode) )->eraseConnectedElement( this->giveNumber() ); @@ -1814,7 +1812,7 @@ Subdivision :: RS_Tetra :: generate(std :: list< int > &sharedEdgesQueue) IntArray _nodes(4); Subdivision :: RS_Tetra *child; Subdivision :: RS_Element *ngb; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE int eNum = this->mesh->giveNumberOfEdges(); Subdivision :: RS_SharedEdge *_edge; bool ishared = false, jshared = false, kshared = false; @@ -1867,7 +1865,7 @@ Subdivision :: RS_Tetra :: generate(std :: list< int > &sharedEdgesQueue) this->children.resize(2); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( shared_edges.giveSize() ) { if ( shared_edges.at(iedge) ) { ishared = true; @@ -1964,7 +1962,7 @@ Subdivision :: RS_Tetra :: generate(std :: list< int > &sharedEdgesQueue) } } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE int i_shared_id = 0, n_shared_id = 0; // check whether new edges are potentially shared @@ -2039,7 +2037,7 @@ Subdivision :: RS_Tetra :: generate(std :: list< int > &sharedEdgesQueue) // neihgbor4 of child1 is changed to negative during subdivision (if any) of child2 child->setNeighbor(4, childNum + 1); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE // set shared info if ( ishared || kshared || iishared || jjshared ) { child->makeSharedEdges(); @@ -2066,7 +2064,7 @@ Subdivision :: RS_Tetra :: generate(std :: list< int > &sharedEdgesQueue) #endif #ifdef DEBUG_INFO - #ifdef __PARALLEL_MODE + #ifdef __MPI_PARALLEL_MODE OOFEM_LOG_INFO("[%d] Child %d generated on parent %d [%d] (leIndex %d, nds %d %d %d %d [%d %d %d %d], ngbs %d %d %d %d, irr %d %d %d %d %d %d [%d %d %d %d %d %d])\n", mesh->giveSubdivision()->giveRank(), childNum, this->number, this->giveGlobalNumber(), this->leIndex, @@ -2119,7 +2117,7 @@ Subdivision :: RS_Tetra :: generate(std :: list< int > &sharedEdgesQueue) // neihgbor2 of child2 is changed to negative during subdivision (if any) of child1 child->setNeighbor(2, childNum - 1); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE // set shared info if ( ishared || jshared || iishared || kkshared ) { child->makeSharedEdges(); @@ -2145,7 +2143,7 @@ Subdivision :: RS_Tetra :: generate(std :: list< int > &sharedEdgesQueue) #endif -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE // set connected elements if ( mesh->giveNode( nodes.at(inode) )->giveParallelMode() == DofManager_shared ) { mesh->giveNode( nodes.at(inode) )->eraseConnectedElement( this->giveNumber() ); @@ -2177,7 +2175,7 @@ Subdivision :: RS_Tetra :: generate(std :: list< int > &sharedEdgesQueue) #endif #ifdef DEBUG_INFO - #ifdef __PARALLEL_MODE + #ifdef __MPI_PARALLEL_MODE OOFEM_LOG_INFO("[%d] Child %d generated on parent %d [%d] (leIndex %d, nds %d %d %d %d [%d %d %d %d], ngbs %d %d %d %d, irr %d %d %d %d %d %d [%d %d %d %d %d %d])\n", mesh->giveSubdivision()->giveRank(), childNum, this->number, this->giveGlobalNumber(), this->leIndex, @@ -2205,7 +2203,7 @@ Subdivision :: RS_Tetra :: generate(std :: list< int > &sharedEdgesQueue) #endif // set connected elements to nonshared nodes on outer boundary -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( !ishared ) { #endif if ( mesh->giveNode( irregular_nodes.at(iedge) )->giveNumber() < 0 ) { // check for marked local irregular @@ -2217,7 +2215,7 @@ Subdivision :: RS_Tetra :: generate(std :: list< int > &sharedEdgesQueue) // update connectivity of both end nodes of iedge if not shared // and ONLY if there is already list of connected elements -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( mesh->giveNode( nodes.at(jnode) )->giveParallelMode() != DofManager_shared ) { // update already done #endif if ( mesh->giveNode( nodes.at(jnode) )->giveConnectedElements()->giveSize() ) { @@ -2225,11 +2223,11 @@ Subdivision :: RS_Tetra :: generate(std :: list< int > &sharedEdgesQueue) mesh->giveNode( nodes.at(jnode) )->insertConnectedElement(childNum - 1); } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE } #endif -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( mesh->giveNode( nodes.at(knode) )->giveParallelMode() != DofManager_shared ) { // update already done #endif if ( mesh->giveNode( nodes.at(knode) )->giveConnectedElements()->giveSize() ) { @@ -2237,18 +2235,18 @@ Subdivision :: RS_Tetra :: generate(std :: list< int > &sharedEdgesQueue) mesh->giveNode( nodes.at(knode) )->insertConnectedElement(childNum); } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE } #endif -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE } #endif -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( !iishared ) { #endif // update connectivity of both end nodes of iiedge if not shared // and ONLY if there is already list of connected elements -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( mesh->giveNode( nodes.at(inode) )->giveParallelMode() != DofManager_shared ) { // update already done #endif if ( mesh->giveNode( nodes.at(inode) )->giveConnectedElements()->giveSize() ) { @@ -2257,10 +2255,10 @@ Subdivision :: RS_Tetra :: generate(std :: list< int > &sharedEdgesQueue) mesh->giveNode( nodes.at(inode) )->insertConnectedElement(childNum - 1); } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE } #endif -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( mesh->giveNode( nodes.at(nnode) )->giveParallelMode() != DofManager_shared ) { // update already done #endif if ( mesh->giveNode( nodes.at(nnode) )->giveConnectedElements()->giveSize() ) { @@ -2269,10 +2267,10 @@ Subdivision :: RS_Tetra :: generate(std :: list< int > &sharedEdgesQueue) mesh->giveNode( nodes.at(nnode) )->insertConnectedElement(childNum - 1); } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE } #endif -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE } #endif } else { @@ -2343,7 +2341,7 @@ Subdivision :: RS_Tetra :: generate(std :: list< int > &sharedEdgesQueue) } } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE int j_shared_id = 0, k_shared_id = 0; // check whether new edges are potentially shared @@ -2416,7 +2414,7 @@ Subdivision :: RS_Tetra :: generate(std :: list< int > &sharedEdgesQueue) // neihgbor3 of child1 is changed to negative during subdivision (if any) of child2 child->setNeighbor(3, childNum + 1); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE // set shared info if ( ishared || jshared || kshared || iishared ) { child->makeSharedEdges(); @@ -2443,7 +2441,7 @@ Subdivision :: RS_Tetra :: generate(std :: list< int > &sharedEdgesQueue) #endif #ifdef DEBUG_INFO - #ifdef __PARALLEL_MODE + #ifdef __MPI_PARALLEL_MODE OOFEM_LOG_INFO("[%d] Child %d generated on parent %d [%d] (leIndex %d, nds %d %d %d %d [%d %d %d %d], ngbs %d %d %d %d, irr %d %d %d %d %d %d [%d %d %d %d %d %d])\n", mesh->giveSubdivision()->giveRank(), childNum, this->number, this->giveGlobalNumber(), this->leIndex, @@ -2496,7 +2494,7 @@ Subdivision :: RS_Tetra :: generate(std :: list< int > &sharedEdgesQueue) // neihgbor1 of child2 is changed to negative during subdivision (if any) of child1 child->setNeighbor(1, childNum - 1); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE // set shared info if ( ishared || jjshared || kkshared || iishared ) { child->makeSharedEdges(); @@ -2522,7 +2520,7 @@ Subdivision :: RS_Tetra :: generate(std :: list< int > &sharedEdgesQueue) #endif -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE // set connected elements if ( mesh->giveNode( nodes.at(jnode) )->giveParallelMode() == DofManager_shared ) { mesh->giveNode( nodes.at(jnode) )->eraseConnectedElement( this->giveNumber() ); @@ -2554,7 +2552,7 @@ Subdivision :: RS_Tetra :: generate(std :: list< int > &sharedEdgesQueue) #endif #ifdef DEBUG_INFO - #ifdef __PARALLEL_MODE + #ifdef __MPI_PARALLEL_MODE OOFEM_LOG_INFO("[%d] Child %d generated on parent %d [%d] (leIndex %d, nds %d %d %d %d [%d %d %d %d], ngbs %d %d %d %d, irr %d %d %d %d %d %d [%d %d %d %d %d %d])\n", mesh->giveSubdivision()->giveRank(), childNum, this->number, this->giveGlobalNumber(), this->leIndex, @@ -2582,7 +2580,7 @@ Subdivision :: RS_Tetra :: generate(std :: list< int > &sharedEdgesQueue) #endif // set connected elements to nonshared nodes on outer boundary -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( !iishared ) { #endif if ( mesh->giveNode( irregular_nodes.at(iiedge) )->giveNumber() < 0 ) { // check for marked local irregular @@ -2594,7 +2592,7 @@ Subdivision :: RS_Tetra :: generate(std :: list< int > &sharedEdgesQueue) // update connectivity of both end nodes of iiedge if not shared // and ONLY if there is already list of connected elements -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( mesh->giveNode( nodes.at(inode) )->giveParallelMode() != DofManager_shared ) { // update already done #endif if ( mesh->giveNode( nodes.at(inode) )->giveConnectedElements()->giveSize() ) { @@ -2602,10 +2600,10 @@ Subdivision :: RS_Tetra :: generate(std :: list< int > &sharedEdgesQueue) mesh->giveNode( nodes.at(inode) )->insertConnectedElement(childNum - 1); } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE } #endif -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( mesh->giveNode( nodes.at(nnode) )->giveParallelMode() != DofManager_shared ) { // update already done #endif if ( mesh->giveNode( nodes.at(nnode) )->giveConnectedElements()->giveSize() ) { @@ -2613,18 +2611,18 @@ Subdivision :: RS_Tetra :: generate(std :: list< int > &sharedEdgesQueue) mesh->giveNode( nodes.at(nnode) )->insertConnectedElement(childNum); } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE } #endif -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE } #endif -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( !ishared ) { #endif // update connectivity of both end nodes of iedge if not shared // and ONLY if there is already list of connected elements -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( mesh->giveNode( nodes.at(jnode) )->giveParallelMode() != DofManager_shared ) { // update already done #endif if ( mesh->giveNode( nodes.at(jnode) )->giveConnectedElements()->giveSize() ) { @@ -2633,10 +2631,10 @@ Subdivision :: RS_Tetra :: generate(std :: list< int > &sharedEdgesQueue) mesh->giveNode( nodes.at(jnode) )->insertConnectedElement(childNum - 1); } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE } #endif -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( mesh->giveNode( nodes.at(knode) )->giveParallelMode() != DofManager_shared ) { // update already done #endif if ( mesh->giveNode( nodes.at(knode) )->giveConnectedElements()->giveSize() ) { @@ -2645,10 +2643,10 @@ Subdivision :: RS_Tetra :: generate(std :: list< int > &sharedEdgesQueue) mesh->giveNode( nodes.at(knode) )->insertConnectedElement(childNum - 1); } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE } #endif -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE } #endif } @@ -3028,7 +3026,7 @@ Subdivision :: RS_Triangle :: importConnectivity(ConnectivityTable *ct) continue; } - #ifdef __PARALLEL_MODE + #ifdef __MPI_PARALLEL_MODE if ( mesh->giveElement(el)->giveParallelMode() != Element_local ) { continue; } @@ -3056,7 +3054,7 @@ Subdivision :: RS_Triangle :: importConnectivity(ConnectivityTable *ct) continue; } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( mesh->giveElement(el)->giveParallelMode() != Element_local ) { continue; } @@ -3075,7 +3073,7 @@ Subdivision :: RS_Triangle :: importConnectivity(ConnectivityTable *ct) continue; } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( mesh->giveElement(el)->giveParallelMode() != Element_local ) { continue; } @@ -3098,7 +3096,7 @@ Subdivision :: RS_Triangle :: importConnectivity(ConnectivityTable *ct) continue; } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( mesh->giveElement(el)->giveParallelMode() != Element_local ) { continue; } @@ -3137,7 +3135,7 @@ Subdivision :: RS_Tetra :: importConnectivity(ConnectivityTable *ct) continue; } - #ifdef __PARALLEL_MODE + #ifdef __MPI_PARALLEL_MODE if ( mesh->giveElement(el)->giveParallelMode() != Element_local ) { continue; } @@ -3164,7 +3162,7 @@ Subdivision :: RS_Tetra :: importConnectivity(ConnectivityTable *ct) continue; } - #ifdef __PARALLEL_MODE + #ifdef __MPI_PARALLEL_MODE if ( mesh->giveElement(el)->giveParallelMode() != Element_local ) { continue; } @@ -3196,7 +3194,7 @@ Subdivision :: RS_Tetra :: importConnectivity(ConnectivityTable *ct) continue; } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( mesh->giveElement(el)->giveParallelMode() != Element_local ) { continue; } @@ -3230,7 +3228,7 @@ Subdivision :: RS_Tetra :: importConnectivity(ConnectivityTable *ct) continue; } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( mesh->giveElement(el)->giveParallelMode() != Element_local ) { continue; } @@ -3408,7 +3406,7 @@ Subdivision :: createMesh(TimeStep *tStep, int domainNumber, int domainSerNum, D domain->giveErrorEstimator ( )->giveRemeshingCrit ( )->giveRequiredDofManDensity ( i, tStep ), domain->giveNode ( i )->isBoundary() ); _node->setGlobalNumber( domain->giveNode(i)->giveGlobalNumber() ); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE _node->setParallelMode( domain->giveNode(i)->giveParallelMode() ); _node->setPartitions( * domain->giveNode(i)->givePartitionList() ); #endif @@ -3435,10 +3433,9 @@ Subdivision :: createMesh(TimeStep *tStep, int domainNumber, int domainSerNum, D _element = new Subdivision :: RS_Tetra(i, mesh, i, enodes); } else { OOFEM_ERROR("Unsupported element geometry (element %d)", i); - _element = NULL; } _element->setGlobalNumber( domain->giveElement(i)->giveGlobalNumber() ); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE _element->setParallelMode( domain->giveElement(i)->giveParallelMode() ); #endif this->mesh->addElement(_element); @@ -3447,7 +3444,7 @@ Subdivision :: createMesh(TimeStep *tStep, int domainNumber, int domainSerNum, D // import connectivities for local elements only for ( int i = 1; i <= nelems; i++ ) { -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( this->mesh->giveElement(i)->giveParallelMode() != Element_local ) { continue; } @@ -3456,7 +3453,7 @@ Subdivision :: createMesh(TimeStep *tStep, int domainNumber, int domainSerNum, D this->mesh->giveElement(i)->importConnectivity( domain->giveConnectivityTable() ); } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE // import connectivities for shared nodes only // build global shared node map (for top level only) this->mesh->initGlobalSharedNodeMap(); @@ -3496,7 +3493,7 @@ Subdivision :: createMesh(TimeStep *tStep, int domainNumber, int domainSerNum, D #ifdef DRAW_MESH_BEFORE_BISECTION nelems = mesh->giveNumberOfElements(); for ( int i = 1; i <= nelems; i++ ) { - #ifdef __PARALLEL_MODE + #ifdef __MPI_PARALLEL_MODE if ( this->mesh->giveElement(i)->giveParallelMode() != Element_local ) { continue; } @@ -3528,7 +3525,7 @@ Subdivision :: createMesh(TimeStep *tStep, int domainNumber, int domainSerNum, D continue; } - #ifdef __PARALLEL_MODE + #ifdef __MPI_PARALLEL_MODE if ( this->mesh->giveElement(i)->giveParallelMode() != Element_local ) { continue; } @@ -3573,14 +3570,13 @@ Subdivision :: createMesh(TimeStep *tStep, int domainNumber, int domainSerNum, D dof = new SimpleSlaveDof( node, simpleSlaveDofPtr->giveMasterDofManagerNum(), idofPtr->giveDofID() ); } else { OOFEM_ERROR("unsupported DOF type"); - dof = nullptr; } } node->appendDof(dof); } node->setGlobalNumber( parentNodePtr->giveGlobalNumber() ); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE node->setParallelMode( parentNodePtr->giveParallelMode() ); node->setPartitionList( parentNodePtr->givePartitionList() ); #endif @@ -3750,7 +3746,7 @@ Subdivision :: createMesh(TimeStep *tStep, int domainNumber, int domainSerNum, D } node->setGlobalNumber( mesh->giveNode(inode)->giveGlobalNumber() ); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE node->setParallelMode( mesh->giveNode(inode)->giveParallelMode() ); node->setPartitionList( mesh->giveNode(inode)->givePartitions() ); #endif @@ -3767,7 +3763,7 @@ Subdivision :: createMesh(TimeStep *tStep, int domainNumber, int domainSerNum, D int nterminals = 0; nelems = mesh->giveNumberOfElements(); for ( int ielem = 1; ielem <= nelems; ielem++ ) { -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( mesh->giveElement(ielem)->giveParallelMode() != Element_local ) { continue; } @@ -3778,13 +3774,13 @@ Subdivision :: createMesh(TimeStep *tStep, int domainNumber, int domainSerNum, D } } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE IntArray parentElemMap(nterminals); #endif ( * dNew )->resizeElements(nterminals); int eNum = 0; for ( int ielem = 1; ielem <= nelems; ielem++ ) { -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( mesh->giveElement(ielem)->giveParallelMode() != Element_local ) { continue; } @@ -3796,7 +3792,7 @@ Subdivision :: createMesh(TimeStep *tStep, int domainNumber, int domainSerNum, D eNum++; parent = mesh->giveElement(ielem)->giveTopParent(); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE parentElemMap.at(eNum) = parent; #endif if ( parent ) { @@ -3807,7 +3803,7 @@ Subdivision :: createMesh(TimeStep *tStep, int domainNumber, int domainSerNum, D auto elem = classFactory.createElement(name.c_str(), eNum, * dNew); elem->initializeFrom(ir); elem->setGlobalNumber( mesh->giveElement(ielem)->giveGlobalNumber() ); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE //ir.setRecordKeywordNumber( mesh->giveElement(ielem)->giveGlobalNumber() ); // not subdivided elements inherit globNum, subdivided give -1 // local elements have array partitions empty ! @@ -3909,7 +3905,7 @@ Subdivision :: createMesh(TimeStep *tStep, int domainNumber, int domainSerNum, D ( * dNew )->giveOutputManager()->beCopyOf( domain->giveOutputManager() ); timer.stopTimer(); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE OOFEM_LOG_INFO( "[%d] Subdivision: created new mesh (%d nodes and %d elements) in %.2fs\n", ( * dNew )->giveEngngModel()->giveRank(), nnodes, eNum, timer.getUtime() ); #else @@ -3920,7 +3916,7 @@ Subdivision :: createMesh(TimeStep *tStep, int domainNumber, int domainSerNum, D -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE #ifdef __VERBOSE_PARALLEL nnodes = ( * dNew )->giveNumberOfDofManagers(); for ( int inode = 1; inode <= nnodes; inode++ ) { @@ -4007,7 +4003,7 @@ Subdivision :: bisectMesh() RS_Element *elem; RS_Node *node; //std::queue subdivqueue; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE int remote_elems = 0; int myrank = this->giveRank(); int problem_size = this->giveNumberOfProcesses(); @@ -4021,7 +4017,7 @@ Subdivision :: bisectMesh() for ( int in = 1; in <= nnodes; in++ ) { maxlocalglobal = max( maxlocalglobal, mesh->giveNode(in)->giveGlobalNumber() ); } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE // determine max global number on all partitions MPI_Allreduce(& maxlocalglobal, & maxglobalnumber, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD); #else @@ -4034,7 +4030,7 @@ Subdivision :: bisectMesh() nnodes_old = nnodes; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE OOFEM_LOG_INFO("[%d] Subdivision::bisectMesh: entering bisection loop %d\n", myrank, ++loop); #else OOFEM_LOG_INFO("Subdivision::bisectMesh: entering bisection loop %d\n", ++loop); @@ -4043,7 +4039,7 @@ Subdivision :: bisectMesh() // process only newly created elements in pass 2 and more for ( ie = nelems_old + 1; ie <= nelems; ie++ ) { elem = mesh->giveElement(ie); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE // skip bisection of remote elements (in first pass only (nelems_old = 0)); // in pass 2 and more there should be no remote elements because // only newly created elements are processed @@ -4060,7 +4056,7 @@ Subdivision :: bisectMesh() continue; } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE // bisect local elements only if ( elem->giveParallelMode() != Element_local ) { continue; @@ -4086,11 +4082,11 @@ Subdivision :: bisectMesh() -#ifndef __PARALLEL_MODE +#ifndef __MPI_PARALLEL_MODE repeat = 1; // force repetition in seqeuntial run #endif /* - * #ifdef __PARALLEL_MODE + * #ifdef __MPI_PARALLEL_MODE * OOFEM_LOG_INFO("[%d] Subdivision: scheduling element %d[%d] for bisection, dens=%lf rdens=%lf\n", myrank, ie, elem->giveGlobalNumber(), iedensity, rdensity); ******#else * OOFEM_LOG_INFO("Subdivision: scheduling element %d for bisection, dens=%lf rdens=%lf\n", ie, iedensity, rdensity); @@ -4100,21 +4096,21 @@ Subdivision :: bisectMesh() } #ifdef DEBUG_INFO - #ifdef __PARALLEL_MODE + #ifdef __MPI_PARALLEL_MODE OOFEM_LOG_INFO("[%d] (with %d nodes and %d elems)\n", myrank, nnodes_old, terminal_local_elems + remote_elems); #else OOFEM_LOG_INFO("(with %d nodes and %d elems)\n", nnodes_old, terminal_local_elems); #endif #endif -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE for ( value = 0; value == 0; value = exchangeSharedIrregulars() ) { #endif // loop over subdivision queue to bisect all local elements there while ( !subdivqueue.empty() ) { elem = mesh->giveElement( subdivqueue.front() ); #ifdef DEBUG_CHECK - #ifdef __PARALLEL_MODE + #ifdef __MPI_PARALLEL_MODE if ( elem->giveParallelMode() != Element_local ) { OOFEM_ERROR( "nonlocal element %d not expected for bisection", elem->giveNumber() ); } @@ -4126,7 +4122,7 @@ Subdivision :: bisectMesh() subdivqueue.pop(); } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE // in parallel communicate with neighbours the irregular nodes on shared bondary } @@ -4135,7 +4131,7 @@ Subdivision :: bisectMesh() int in; nnodes = mesh->giveNumberOfNodes(); -#ifndef __PARALLEL_MODE +#ifndef __MPI_PARALLEL_MODE int myrank = 0; #endif // assign global numbers to newly introduced irregulars while @@ -4157,7 +4153,7 @@ Subdivision :: bisectMesh() } } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE #ifdef __VERBOSE_PARALLEL OOFEM_LOG_INFO("[%d] Subdivision::bisectMesh: number of new local irregulars is %d\n", myrank, localIrregulars); #endif @@ -4192,7 +4188,7 @@ Subdivision :: bisectMesh() #endif -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE // finally, communicate global numbers assigned to shared irregulars this->assignGlobalNumbersToSharedIrregulars(); for ( in = nnodes_old+1; in <= nnodes; in++ ) { @@ -4237,7 +4233,7 @@ Subdivision :: bisectMesh() continue; } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( elem->giveParallelMode() != Element_local ) { continue; } @@ -4246,7 +4242,7 @@ Subdivision :: bisectMesh() elem->generate(sharedEdgesQueue); } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( globalIrregulars ) { // exchange shared edges // this must be done after globnums are assigned to new shared irregulars @@ -4271,7 +4267,7 @@ Subdivision :: bisectMesh() continue; } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( elem->giveParallelMode() != Element_local ) { continue; } @@ -4282,7 +4278,7 @@ Subdivision :: bisectMesh() } #if 0 - #ifdef __PARALLEL_MODE + #ifdef __MPI_PARALLEL_MODE int global_repeat = 0; // determine whether any partition needs additional bisection pass @@ -4305,7 +4301,7 @@ Subdivision :: bisectMesh() #endif #endif } // end bisection loop -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if (partitionsIrregulars) { delete[] partitionsIrregulars; } @@ -4329,7 +4325,7 @@ Subdivision :: smoothMesh() char buffer [ 1024 ]; int len; #endif -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE OOFEM_LOG_INFO( "[%d] Subdivision::smoothMesh\n", this->giveRank() ); #else OOFEM_LOG_INFO("Subdivision::smoothMesh\n"); @@ -4347,7 +4343,7 @@ Subdivision :: smoothMesh() continue; } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( elem->giveParallelMode() != Element_local ) { continue; } @@ -4377,7 +4373,7 @@ Subdivision :: smoothMesh() continue; } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( elem->giveParallelMode() != Element_local ) { continue; } @@ -4398,7 +4394,7 @@ Subdivision :: smoothMesh() } #ifdef DEBUG_SMOOTHING - #ifdef __PARALLEL_MODE + #ifdef __MPI_PARALLEL_MODE OOFEM_LOG_INFO( "[%d] Subdivision::smoothMesh: connectivity node_id: elem_ids\n", this->giveRank() ); #else OOFEM_LOG_INFO("Subdivision::smoothMesh: connectivity node_id: elem_ids\n"); @@ -4487,7 +4483,7 @@ Subdivision :: smoothMesh() } #ifdef DEBUG_SMOOTHING - #ifdef __PARALLEL_MODE + #ifdef __MPI_PARALLEL_MODE OOFEM_LOG_INFO( "[%d] Subdivision::smoothMesh: connectivity node_id: node_ids\n", this->giveRank() ); #else OOFEM_LOG_INFO("Subdivision::smoothMesh: connectivity node_id: node_ids\n"); @@ -4585,7 +4581,7 @@ Subdivision :: smoothMesh() #else for ( in = 1; in <= nnodes; in++ ) { #endif -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( ( mesh->giveNode(in)->giveParallelMode() == DofManager_shared ) || ( mesh->giveNode(in)->giveParallelMode() == DofManager_null ) ) { continue; // skip shared and remote node @@ -4657,7 +4653,7 @@ Subdivision :: smoothMesh() bool Subdivision :: isNodeLocalIrregular(Subdivision :: RS_Node *node, int myrank) { -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( node->isIrregular() ) { if ( node->giveParallelMode() == DofManager_local ) { return true; @@ -4690,7 +4686,7 @@ void Subdivision :: assignGlobalNumbersToElements(Domain *d) { -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE int problem_size = this->giveNumberOfProcesses(); int myrank = this->giveRank(); @@ -4779,7 +4775,7 @@ Subdivision :: assignGlobalNumbersToElements(Domain *d) -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE bool Subdivision :: exchangeSharedIrregulars() { diff --git a/src/oofemlib/subdivision.h b/src/oofemlib/subdivision.h index b1a2ea348..76e3b8f5c 100644 --- a/src/oofemlib/subdivision.h +++ b/src/oofemlib/subdivision.h @@ -86,7 +86,7 @@ class OOFEM_EXPORT Subdivision : public MesherInterface // (in such a case the list is built on the fly) IntArray connectedElements; int globalNumber; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE dofManagerParallelMode parallel_mode; /** * List of partition sharing the shared dof manager or @@ -103,7 +103,7 @@ class OOFEM_EXPORT Subdivision : public MesherInterface this->boundary = boundary; this->parent = parent; this->globalNumber = 0; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE this->parallel_mode = DofManager_local; #endif } @@ -126,7 +126,7 @@ class OOFEM_EXPORT Subdivision : public MesherInterface void setGlobalNumber(int gn) { this->globalNumber = gn; } virtual bool isIrregular() { return false; } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE void numberSharedEdges(); dofManagerParallelMode giveParallelMode() const { return parallel_mode; } void setParallelMode(dofManagerParallelMode _mode) { parallel_mode = _mode; } @@ -177,7 +177,7 @@ class OOFEM_EXPORT Subdivision : public MesherInterface // flag whether element is in bisection queue bool queue_flag; int globalNumber; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE elementParallelMode parallel_mode; // numbers of shared edges IntArray shared_edges; @@ -191,7 +191,7 @@ class OOFEM_EXPORT Subdivision : public MesherInterface this->parent = parent; this->queue_flag = false; this->globalNumber = -1; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE this->parallel_mode = Element_local; #endif } @@ -240,7 +240,7 @@ class OOFEM_EXPORT Subdivision : public MesherInterface int giveGlobalNumber() { return globalNumber; } void setGlobalNumber(int gn) { this->globalNumber = gn; } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE virtual void numberSharedEdges(int iNode, IntArray &connNodes) = 0; const IntArray *giveSharedEdges() { return & shared_edges; } virtual void makeSharedEdges() = 0; @@ -268,9 +268,9 @@ class OOFEM_EXPORT Subdivision : public MesherInterface #ifdef __OOFEG void drawGeometry() override; #endif -#ifdef __PARALLEL_MODE - void numberSharedEdges(int iNode, IntArray &connNodes); - void makeSharedEdges() { +#ifdef __MPI_PARALLEL_MODE + void numberSharedEdges(int iNode, IntArray &connNodes) override; + void makeSharedEdges() override { shared_edges.resize(3); shared_edges.zero(); } @@ -295,16 +295,16 @@ class OOFEM_EXPORT Subdivision : public MesherInterface #ifdef __OOFEG void drawGeometry() override; #endif -#ifdef __PARALLEL_MODE - void numberSharedEdges(int iNode, IntArray &connNodes); - void makeSharedEdges() { +#ifdef __MPI_PARALLEL_MODE + void numberSharedEdges(int iNode, IntArray &connNodes) override; + void makeSharedEdges() override { shared_edges.resize(6); shared_edges.zero(); } #endif }; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE class RS_SharedEdge { protected: @@ -339,12 +339,12 @@ class OOFEM_EXPORT Subdivision : public MesherInterface // HUHU protected? private? std :: vector< std :: unique_ptr< Subdivision :: RS_Node > >nodes; std :: vector< std :: unique_ptr< Subdivision :: RS_Element > >elements; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE std :: vector< std :: unique_ptr< Subdivision :: RS_SharedEdge > >edges; #endif Subdivision *subdivision; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE /// Global shared node map (index is global shared node number) std :: map< int, Subdivision :: RS_Node * >sharedNodeMap; /// sharedNodeMap init flag @@ -352,7 +352,7 @@ class OOFEM_EXPORT Subdivision : public MesherInterface #endif public: -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE RS_Mesh(Subdivision * s) : nodes(), elements(), edges() { this->subdivision = s; sharedNodeMapInitialized = false; @@ -370,7 +370,7 @@ class OOFEM_EXPORT Subdivision : public MesherInterface int giveNumberOfElements() { return (int)elements.size(); } void addNode(Subdivision :: RS_Node *obj) { nodes.emplace_back(obj); } void addElement(Subdivision :: RS_Element *obj) { elements.emplace_back(obj); } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE Subdivision :: RS_SharedEdge *giveEdge(int i) { return edges[i-1].get(); } int giveNumberOfEdges() { return (int)edges.size(); } void addEdge(Subdivision :: RS_SharedEdge *obj) { edges.emplace_back(obj); } @@ -430,7 +430,7 @@ class OOFEM_EXPORT Subdivision : public MesherInterface bool isNodeLocalIrregular(Subdivision :: RS_Node *node, int myrank); void assignGlobalNumbersToElements(Domain *d); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE /** * Exchanges the shared irregulars between partitions. Returns true if any shared irregular has been * exchanged between any partitions. diff --git a/src/oofemlib/surfacetensionbc.C b/src/oofemlib/surfacetensionbc.C index 0a31db0fc..f029e67b2 100644 --- a/src/oofemlib/surfacetensionbc.C +++ b/src/oofemlib/surfacetensionbc.C @@ -86,7 +86,7 @@ void SurfaceTensionBoundaryCondition :: giveLocationArrays(std :: vector< IntArr Element *e = this->giveDomain()->giveElement( boundaries.at(pos * 2 - 1) ); int boundary = boundaries.at(pos * 2); - const auto &bNodes = e->giveInterpolation()->boundaryGiveNodes(boundary); + const auto &bNodes = e->giveInterpolation()->boundaryGiveNodes(boundary, e->giveGeometryType()); e->giveBoundaryLocationArray(rows [ pos ], bNodes, this->dofs, r_s); e->giveBoundaryLocationArray(cols [ pos ], bNodes, this->dofs, c_s); @@ -103,7 +103,7 @@ void SurfaceTensionBoundaryCondition :: assemble(SparseMtrx &answer, TimeStep *t } OOFEM_ERROR("Not implemented yet."); - +#if 0 FloatMatrix Ke; IntArray r_loc, c_loc; @@ -114,7 +114,7 @@ void SurfaceTensionBoundaryCondition :: assemble(SparseMtrx &answer, TimeStep *t Element *e = this->giveDomain()->giveElement( boundaries.at(pos * 2 - 1) ); int boundary = boundaries.at(pos * 2); - const auto &bNodes = e->giveInterpolation()->boundaryGiveNodes(boundary); + const auto &bNodes = e->giveInterpolation()->boundaryGiveNodes(boundary, e->giveGeometryType()); e->giveBoundaryLocationArray(r_loc, bNodes, this->dofs, r_s); e->giveBoundaryLocationArray(c_loc, bNodes, this->dofs, c_s); @@ -128,6 +128,7 @@ void SurfaceTensionBoundaryCondition :: assemble(SparseMtrx &answer, TimeStep *t if (lock) omp_unset_lock(static_cast(lock)); #endif } +#endif } void SurfaceTensionBoundaryCondition :: assembleVector(FloatArray &answer, TimeStep *tStep, @@ -150,7 +151,7 @@ void SurfaceTensionBoundaryCondition :: assembleVector(FloatArray &answer, TimeS Element *e = this->giveDomain()->giveElement( boundaries.at(pos * 2 - 1) ); int boundary = boundaries.at(pos * 2); - const auto &bNodes = e->giveInterpolation()->boundaryGiveNodes(boundary); + const auto &bNodes = e->giveInterpolation()->boundaryGiveNodes(boundary, e->giveGeometryType()); e->giveBoundaryLocationArray(loc, bNodes, this->dofs, s, & masterdofids); this->computeLoadVectorFromElement(fe, e, boundary, tStep); @@ -173,7 +174,7 @@ void SurfaceTensionBoundaryCondition :: computeTangentFromElement(FloatMatrix &a if ( !fei ) { OOFEM_ERROR("No interpolation available for element."); } - std :: unique_ptr< IntegrationRule > iRule( fei->giveBoundaryIntegrationRule(fei->giveInterpolationOrder()-1, side) ); + std :: unique_ptr< IntegrationRule > iRule( fei->giveBoundaryIntegrationRule(fei->giveInterpolationOrder()-1, side, e->giveGeometryType()) ); int nsd = e->giveDomain()->giveNumberOfSpatialDimensions(); int nodes = e->giveNumberOfNodes(); @@ -253,10 +254,10 @@ void SurfaceTensionBoundaryCondition :: computeTangentFromElement(FloatMatrix &a answer.symmetrized(); } else if ( nsd == 3 ) { - FEInterpolation3d *fei3d = static_cast< FEInterpolation3d * >(fei); + //FEInterpolation3d *fei3d = static_cast< FEInterpolation3d * >(fei); OOFEM_ERROR("3D tangents not implemented yet."); - +#if 0 //FloatMatrix tmp(3 *nodes, 3 *nodes); FloatMatrix dNdx; FloatArray n; @@ -273,6 +274,7 @@ void SurfaceTensionBoundaryCondition :: computeTangentFromElement(FloatMatrix &a //answer.plusProductSymmUpper(A,B, dV); ///@todo Derive expressions for this. } +#endif } else { OOFEM_WARNING("Only 2D or 3D is possible!"); } @@ -284,7 +286,7 @@ void SurfaceTensionBoundaryCondition :: computeLoadVectorFromElement(FloatArray if ( !fei ) { OOFEM_ERROR("No interpolation or default integration available for element."); } - std :: unique_ptr< IntegrationRule > iRule( fei->giveBoundaryIntegrationRule(fei->giveInterpolationOrder()-1, side) ); + std :: unique_ptr< IntegrationRule > iRule( fei->giveBoundaryIntegrationRule(fei->giveInterpolationOrder()-1, side, e->giveGeometryType()) ); int nsd = e->giveDomain()->giveNumberOfSpatialDimensions(); @@ -299,7 +301,7 @@ void SurfaceTensionBoundaryCondition :: computeLoadVectorFromElement(FloatArray FEInterpolation2d *fei2d = static_cast< FEInterpolation2d * >(fei); ///@todo More of this grunt work should be moved to the interpolation classes - const auto &bnodes = fei2d->boundaryGiveNodes(side); + const auto &bnodes = fei2d->boundaryGiveNodes(side, e->giveGeometryType()); int nodes = bnodes.giveSize(); FloatMatrix xy(2, nodes); for ( int i = 1; i <= nodes; i++ ) { diff --git a/src/oofemlib/symcompcol.C b/src/oofemlib/symcompcol.C index 449dc3222..22c8b87b4 100644 --- a/src/oofemlib/symcompcol.C +++ b/src/oofemlib/symcompcol.C @@ -308,7 +308,6 @@ double &SymCompCol :: at(int i, int j) } OOFEM_ERROR("Array accessing exception -- out of bounds"); - return val[0]; // return to suppress compiler warning message } @@ -328,7 +327,6 @@ double SymCompCol :: at(int i, int j) const return 0.0; } else { OOFEM_ERROR("Array accessing exception -- index out of bounds (%d,%d)", i, j); - return ( 0 ); // return to suppress compiler warning message } } @@ -348,7 +346,6 @@ double SymCompCol :: operator() (int i, int j) const return 0.0; } else { OOFEM_ERROR("Array accessing exception, index out of bounds (%d,%d)", i, j); - return ( 0 ); // return to suppress compiler warning message } } @@ -367,6 +364,5 @@ double &SymCompCol :: operator() (int i, int j) } OOFEM_ERROR("Array element (%d,%d) not in sparse structure -- cannot assign", i, j); - return val[0]; // return to suppress compiler warning message } } // end namespace oofem diff --git a/src/oofemlib/t3dinterface.C b/src/oofemlib/t3dinterface.C index d4e5569d6..6c058c8bf 100644 --- a/src/oofemlib/t3dinterface.C +++ b/src/oofemlib/t3dinterface.C @@ -424,7 +424,7 @@ T3DInterface :: t3d_2_OOFEM(const char *t3dOutFile, Domain **dNew) if(i == 0) elemNumber = atoi(token); else if (i >= 1 && i<=4) - dofManagers.at(i) = atof(token); + dofManagers.at(i) = atoi(token); else break; token = std::strtok(nullptr, " "); @@ -457,7 +457,7 @@ T3DInterface :: t3d_2_OOFEM(const char *t3dOutFile, Domain **dNew) if(i == 0) elemNumber = atoi(token); else if (i >= 1 && i<=4) - dofManagers.at(i) = atof(token); + dofManagers.at(i) = atoi(token); else break; token = std::strtok(nullptr, " "); @@ -699,7 +699,7 @@ T3DInterface :: createVTKExportMesh(const char *t3dOutFile,std::vector= 1 && i<=3) - dofManagers.at(i) = atof(token) - 1; + dofManagers.at(i) = atoi(token) - 1; else break; token = std::strtok(NULL, " "); @@ -830,7 +830,7 @@ T3DInterface :: createQCInterpolationMesh(const char *t3dOutFile,std::vector= 1 && i<=3) - dofManagers.at(i) = atof(token); + dofManagers.at(i) = atoi(token); else break; token = std::strtok(NULL, " "); @@ -858,7 +858,7 @@ T3DInterface :: createQCInterpolationMesh(const char *t3dOutFile,std::vector= 1 && i<=4) - dofManagers.at(i) = atof(token); + dofManagers.at(i) = atoi(token); else break; token = std::strtok(NULL, " "); diff --git a/src/oofemlib/tensor/tensor2.h b/src/oofemlib/tensor/tensor2.h index 98accc941..506555731 100644 --- a/src/oofemlib/tensor/tensor2.h +++ b/src/oofemlib/tensor/tensor2.h @@ -118,7 +118,7 @@ class Tensor2_3d : public Tensor2< double, 3, 3 > * @param nf tolerance for eigenvalue calculation * @return Power of a Second-order tensor */ - Tensor2_3d computeTensorPower(double pow, int nf = 1e-10) + Tensor2_3d computeTensorPower(double pow, int nf = 10) { auto [ eVals, eVecs ] = this->eigs(nf); return computeTensorPowerFromEigs(eVals, eVecs, pow); @@ -284,7 +284,7 @@ class Tensor2_3d : public Tensor2< double, 3, 3 > * @param nf - number of significant figures * @return Second-order tensor dC^m_dC */ - Tensor4_3d compute_dCm_dC(double m, int nf = 1e-10) + Tensor4_3d compute_dCm_dC(double m, int nf = 10) { auto [ eVals, eVecs ] = this->eigs(nf); return compute_dCm_dC_fromEigs(m, eVals, eVecs); diff --git a/src/oofemlib/timer.h b/src/oofemlib/timer.h index b8f84eb9a..28bfce8a4 100644 --- a/src/oofemlib/timer.h +++ b/src/oofemlib/timer.h @@ -35,7 +35,7 @@ #ifndef timer_h #define timer_h -#include "oofemcfg.h" +#include "oofemenv.h" #include diff --git a/src/oofemlib/timestep.C b/src/oofemlib/timestep.C index 2ec227675..4c935cfff 100644 --- a/src/oofemlib/timestep.C +++ b/src/oofemlib/timestep.C @@ -51,6 +51,7 @@ TimeStep :: TimeStep(int n, EngngModel *e, int mn, double tt, double dt, StateCo number(n), version(0), subStepNumber(0), mStepNumber(mn), timeDiscretization(td), numberOfIterations(0), numberOfAttempts(0), convergedReason(ConvergedReason::CR_UNKNOWN) { // Target time and intrinsic time is the same in the constructor. + this->solutionTime = 0.0; } TimeStep :: TimeStep(EngngModel *e) @@ -66,6 +67,8 @@ TimeStep :: TimeStep(EngngModel *e) subStepNumber = 0; numberOfIterations = 0; numberOfAttempts = 0; + timeDiscretization = TimeDiscretizationType::TD_Unspecified; + solutionTime = 0.0; convergedReason = ConvergedReason::CR_UNKNOWN; } @@ -83,6 +86,8 @@ TimeStep :: TimeStep(const TimeStep &src) numberOfIterations = src.numberOfIterations; numberOfAttempts = src.numberOfAttempts; convergedReason = src.convergedReason; + timeDiscretization = src.timeDiscretization; + solutionTime = src.solutionTime; } TimeStep :: TimeStep(const TimeStep &previous, double dt) @@ -98,6 +103,8 @@ TimeStep :: TimeStep(const TimeStep &previous, double dt) subStepNumber = 0; numberOfIterations = 0; numberOfAttempts = 0; + timeDiscretization = previous.timeDiscretization; + solutionTime = 0.0; convergedReason = ConvergedReason::CR_UNKNOWN; } @@ -129,8 +136,6 @@ TimeStep *TimeStep :: givePreviousStep() } else { OOFEM_ERROR("Could not return previous step of noncurrent step"); } - - return NULL; // to make compiler happy } diff --git a/src/oofemlib/timestep.h b/src/oofemlib/timestep.h index 7bd609c16..7940585ab 100644 --- a/src/oofemlib/timestep.h +++ b/src/oofemlib/timestep.h @@ -40,7 +40,7 @@ #ifndef timestep_h #define timestep_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "contextioresulttype.h" #include "contextmode.h" #include "statecountertype.h" diff --git a/src/oofemlib/tokenizer.h b/src/oofemlib/tokenizer.h index b24800546..f7c9aff3d 100644 --- a/src/oofemlib/tokenizer.h +++ b/src/oofemlib/tokenizer.h @@ -37,7 +37,7 @@ #include #include -#include "oofemcfg.h" +#include "oofemenv.h" namespace oofem { /** diff --git a/src/oofemlib/topologydescription.h b/src/oofemlib/topologydescription.h index 1efaef952..dfb796c43 100644 --- a/src/oofemlib/topologydescription.h +++ b/src/oofemlib/topologydescription.h @@ -37,7 +37,7 @@ #define topologydescription_h #include "error.h" -#include "oofemcfg.h" +#include "oofemenv.h" namespace oofem { class SpatialLocalizer; diff --git a/src/oofemlib/trianglemesherinterface.C b/src/oofemlib/trianglemesherinterface.C index 5757aa86b..e443870fa 100644 --- a/src/oofemlib/trianglemesherinterface.C +++ b/src/oofemlib/trianglemesherinterface.C @@ -529,11 +529,11 @@ bool TriangleMesherInterface :: meshPSLG(const Triangle_PSLG &pslg, free(output.segmentmarkerlist); //free(output.holelist); //free(output.regionlist); + return true; #else OOFEM_ERROR("OOFEM is not compiled with support for triangle."); #endif - - return true; + } void TriangleMesherInterface :: fixNodeMarkers(const std :: vector< FloatArray > &nodes, std :: vector< IntArray > &n_markers, diff --git a/src/oofemlib/trianglemesherinterface.h b/src/oofemlib/trianglemesherinterface.h index 7d8ba52ba..a389361e1 100644 --- a/src/oofemlib/trianglemesherinterface.h +++ b/src/oofemlib/trianglemesherinterface.h @@ -37,7 +37,7 @@ #include "floatarray.h" #include "intarray.h" -#include "oofemcfg.h" +#include "oofemenv.h" #include diff --git a/src/oofemlib/uniformgridfield.C b/src/oofemlib/uniformgridfield.C index 64057a0e1..137645400 100644 --- a/src/oofemlib/uniformgridfield.C +++ b/src/oofemlib/uniformgridfield.C @@ -124,7 +124,7 @@ int UniformGridField::evaluateAt(FloatArray &answer, const FloatArray &coords, {i,j,k},{I,j,k},{I,J,k},{i,J,k}, {i,j,K},{I,j,K},{I,J,K},{i,J,K} }; - assert(abs(weights[0]+weights[1]+weights[2]+weights[3]+weights[4]+weights[5]+weights[6]+weights[7]-1) < 1e-5); + assert(fabs(weights[0]+weights[1]+weights[2]+weights[3]+weights[4]+weights[5]+weights[6]+weights[7]-1) < 1e-5); for(int p=0; p<8; p++){ // std::cerr<nodeValue3d(pts[p][0],pts[p][1],pts[p][2]); @@ -136,7 +136,7 @@ int UniformGridField::evaluateAt(FloatArray &answer, const FloatArray &coords, const double& x(normXyz[0]); const double y(normXyz[1]); double X(1-x); double Y(1-y); double weights[]={X*Y,x*Y,X*y,x*y}; // TODO: check int pts[][2]={{i,j},{I,j},{i,J},{I,J}}; // TODO: check - assert(abs(weights[0]+weights[1]+weights[2]+weights[3]-1)<1e-5); + assert(fabs(weights[0]+weights[1]+weights[2]+weights[3]-1)<1e-5); for(int p=0; p<4; p++){ // std::cerr<nodeValue2d(pts[p][0],pts[p][1]); diff --git a/src/oofemlib/unstructuredgridfield.h b/src/oofemlib/unstructuredgridfield.h index 69a2b30aa..23396d139 100644 --- a/src/oofemlib/unstructuredgridfield.h +++ b/src/oofemlib/unstructuredgridfield.h @@ -116,6 +116,9 @@ class OOFEM_EXPORT UnstructuredGridField : public Field { return ( ( cell->getVertex(i) )->getCoordinates() ); } + const Element_Geometry_Type giveGeometryType() const override { + return cell->itype; + } }; public: @@ -123,7 +126,7 @@ class OOFEM_EXPORT UnstructuredGridField : public Field itype = EGT_unknown; mesh = NULL; } - Cell(Element_Geometry_Type t, IntArray &v, UnstructuredGridField *m) { + Cell(const Element_Geometry_Type t, IntArray &v, UnstructuredGridField *m) { itype = t; vertices = v; mesh = m; @@ -312,6 +315,17 @@ class OOFEM_EXPORT UnstructuredGridField : public Field } virtual ~UnstructuredGridField() { } + void initialize(int nvert, int ncells, double _octreeOriginShift = 0.0) + { + this->timeStamp = this->octreeTimeStamp = 0; + this->vertexList.resize(nvert); + this->cellList.resize(ncells); + this->valueList.resize(nvert); + this->octreeOriginShift = _octreeOriginShift; + } + int giveNumberOfVertices() const { return (int)vertexList.size(); } + int giveNumberOfCells() const { return (int)cellList.size(); } + void setVertexValue(int num, const FloatArray &vv) { valueList [ num - 1 ] = vv; } @@ -330,7 +344,7 @@ class OOFEM_EXPORT UnstructuredGridField : public Field return & this->vertexList [ num - 1 ]; } - void addCell(int num, Element_Geometry_Type type, IntArray &vertices) { //1-based + void addCell(int num, const Element_Geometry_Type type, IntArray &vertices) { //1-based cellList [ num - 1 ] = Cell(type, vertices, this); this->timeStamp++; } diff --git a/src/oofemlib/util.h b/src/oofemlib/util.h index 768c55af7..3dfbffa5d 100644 --- a/src/oofemlib/util.h +++ b/src/oofemlib/util.h @@ -35,7 +35,7 @@ #ifndef util_h #define util_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "problemmode.h" #include diff --git a/src/oofemlib/vtkbaseexportmodule.C b/src/oofemlib/vtkbaseexportmodule.C index f596005d0..e71040603 100644 --- a/src/oofemlib/vtkbaseexportmodule.C +++ b/src/oofemlib/vtkbaseexportmodule.C @@ -193,7 +193,7 @@ VTKBaseExportModule::giveNumberOfNodesPerCell(int cellType) OOFEM_ERROR("unsupported cell type ID"); } - return 0; // to make compiler happy + // return 0; // to make compiler happy } diff --git a/src/oofemlib/vtkexportmodule.C b/src/oofemlib/vtkexportmodule.C index 730c7367e..f2979491b 100644 --- a/src/oofemlib/vtkexportmodule.C +++ b/src/oofemlib/vtkexportmodule.C @@ -301,7 +301,7 @@ VTKExportModule :: giveNumberOfNodesPerCell(int cellType) OOFEM_ERROR("unsupported cell type ID"); } - return 0; // to make compiler happy + // return 0; // to make compiler happy } @@ -363,7 +363,7 @@ VTKExportModule :: giveNumberOfElementCells(Element *elem) OOFEM_ERROR("unsupported element geometry type"); } - return 0; + // return 0; } //keyword "vars" in OOFEM input file diff --git a/src/oofemlib/vtkhdf5reader.C b/src/oofemlib/vtkhdf5reader.C new file mode 100644 index 000000000..56ed8b3d6 --- /dev/null +++ b/src/oofemlib/vtkhdf5reader.C @@ -0,0 +1,340 @@ +/* + * + * ##### ##### ###### ###### ### ### + * ## ## ## ## ## ## ## ### ## + * ## ## ## ## #### #### ## # ## + * ## ## ## ## ## ## ## ## + * ## ## ## ## ## ## ## ## + * ##### ##### ## ###### ## ## + * + * + * OOFEM : Object Oriented Finite Element Code + * + * Copyright (C) 1993 - 20 Borek Patzak + * + * + * + * Czech Technical University, Faculty of Civil Engineering, + * Department of Structural Mechanics, 166 29 Prague, Czech Republic + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "vtkhdf5reader.h" +#include "unstructuredgridfield.h" +#include "elementgeometrytype.h" +#include "floatarray.h" +#include "element.h" +#include "timestep.h" + +#ifdef __HDF_MODULE +#include +#endif + +namespace oofem { + +#ifndef __HDF_MODULE +VTKHDF5Reader::VTKHDF5Reader() +{ + OOFEM_ERROR("VTKHDF5Reader: HDF5 module not available, cannot read VTKHDF5 files"); +} + + +VTKHDF5Reader::~VTKHDF5Reader() {} +void VTKHDF5Reader::initialize(std::string &fileName) {} +void VTKHDF5Reader::finalize() {} +void VTKHDF5Reader::readMesh(UnstructuredGridField&, TimeStep* tStep) {} +void VTKHDF5Reader::readField(UnstructuredGridField&, TimeStep* tStep, const std::string &field_name) {} + +#else + + +VTKHDF5Reader::VTKHDF5Reader(): stepValues() +{ + this->fileName = ""; + this->file = NULL; +} + +VTKHDF5Reader::~VTKHDF5Reader() { + this->finalize(); +} + +void +VTKHDF5Reader::initialize (std::string& filename) +{ + this->fileName = filename; + // open hdf5 file with fileName + this->file = new H5::H5File(fileName, H5F_ACC_RDONLY); + // open VTHHDF group + // test if VTKHDF group exists + if ( !file->exists("/VTKHDF") ) { + OOFEM_ERROR("VTKHDF group not found in file"); + } + this->topGroup = new H5::Group(file->openGroup("/VTKHDF")); + // read version attribute in topGroup + H5::Attribute versionAttr = topGroup->openAttribute("Version"); + int version[2]; + versionAttr.read(versionAttr.getDataType(), &version); + + // Read type attribute + H5::Attribute typeAttr = topGroup->openAttribute("Type"); + std::string type; + typeAttr.read(typeAttr.getDataType(), type); + + // check version and type + if (version[0] != 2 || version[1] != 2 || type != "UnstructuredGrid") { + OOFEM_ERROR("Unsupported version or type of VTKHDF5 file, version 2.2 and UnstructuredGrid type is required."); + } + + // read NSteps attribute from Steps group + this->stepsGroup = new H5::Group(topGroup->openGroup("Steps")); + H5::Attribute nstepsattr = stepsGroup->openAttribute("NSteps"); + nstepsattr.read(nstepsattr.getDataType(), &numSteps); + // read step values + H5::DataSet values = stepsGroup->openDataSet("Values"); + hsize_t dim[1]; + values.getSpace().getSimpleExtentDims(dim); + this->stepValues.resize(dim[0]); + values.read(this->stepValues.givePointer(), values.getDataType()); +} + +void VTKHDF5Reader::finalize() +{ + if ( this->file ) { + delete this->topGroup; + delete this->stepsGroup; + delete this->file; + this->file=NULL; + } +} + + +void VTKHDF5Reader::readDataSet (H5::DataSet& dset, int rank, hsize_t* dim, hsize_t* offset, H5::DataType type, void* data) +{ + H5::DataSpace dspace = dset.getSpace(); + /* create hyperslab to update point data */ + dspace.selectHyperslab( H5S_SELECT_SET, dim, offset ); + H5::DataSpace mem_space(rank, dim, nullptr); + dset.read(data, type, mem_space, dspace ); +} + +void VTKHDF5Reader::getTimeStepOffsets(TimeStep* tStep, int& nParts, int& pOffset, int& pointOffset, int& cellOffset, int& connIdOffset, int& offsetOfOffset, int& nPoints, int &nCells, int& nconectivities) { + H5::IntType itype(H5::PredType::NATIVE_UINT); + H5::DataType dtype(H5::PredType::NATIVE_DOUBLE); + + // find if tStep time present in array of stepValues, assuming stepValues is sorted + bool found = false; + double tt = tStep->giveTargetTime(); + unsigned int indx = 0; + // simple serach for matching time; could be optimized to take advantage of sorted array + for (indx = 0; indx < stepValues.giveSize(); indx++) { + if (fabs(stepValues[indx] - tt) < 1.e-6) { + found = true; + break; + } + } + if (found) { + // tStep time is present in stepValues array + // read PointOffsets, CellOffsets, and ConnectivityIdOffsets arrays from Steps group + H5::DataSet npDSet = stepsGroup->openDataSet("NumberOfParts"); + H5::DataSet poDSet = stepsGroup->openDataSet("PartOffsets"); + H5::DataSet pointOffsetsDSet = stepsGroup->openDataSet("PointOffsets"); + H5::DataSet cellOffsetsDSet = stepsGroup->openDataSet("CellOffsets"); + H5::DataSet connIdOffsetsDSet = stepsGroup->openDataSet("ConnectivityIdOffsets"); + H5::DataSet offsetsDSet = topGroup->openDataSet( "Offsets" ); + // read the data with offset corresponding to tStep number + hsize_t offset[] = {indx}; + hsize_t dims[1] = {1}; + this->readDataSet(npDSet, 1, dims, offset, itype, &nParts); + this->readDataSet(poDSet, 1, dims, offset, itype, &pOffset); + + this->readDataSet(pointOffsetsDSet, 1, dims, offset, itype, &pointOffset); + hsize_t dims11[] = {1,1}; + hsize_t offset11[] = {indx,0}; + this->readDataSet(cellOffsetsDSet, 2, dims11, offset11, itype, &cellOffset); + this->readDataSet(connIdOffsetsDSet, 2, dims11, offset11, itype, &connIdOffset); + + + // read NumberOfPoints and NumberOfCells and NumberOfConnectivityIds + H5::DataSet numberOfPointsDSet = topGroup->openDataSet("NumberOfPoints"); + H5::DataSet numberOfCellsDSet = topGroup->openDataSet("NumberOfCells"); + H5::DataSet numberOfConnectivityIds = topGroup->openDataSet("NumberOfConnectivityIds"); + + // read numberOfCellsDSet data + int stepCells[numSteps]; + numberOfCellsDSet.read(stepCells, numberOfCellsDSet.getDataType()); + // evaluate offset array offset + offsetOfOffset = 0; + for (int i = 0; i < indx; i++) { + offsetOfOffset += stepCells[i]+1; + } + nCells = stepCells[indx]; + + this->readDataSet(numberOfPointsDSet, 1, dims, offset, itype, &nPoints); + //this->readDataSet(numberOfCellsDSet, 1, dims, offset, itype, &nCells); + this->readDataSet(numberOfConnectivityIds, 1, dims, offset, itype, &nconectivities); + + } else { + // tStep time is not present in stepValues array + OOFEM_ERROR("Matching time not found, time=%lf, step number %d", tt, tStep->giveNumber()); + } +} + +Element_Geometry_Type +VTKHDF5Reader::giveElementGeometryType(int vtkCellType) +{ + Element_Geometry_Type elemGT = EGT_unknown; + + + // implement reverse mapping from vtkCellType to Element_Geometry_Type + if ( vtkCellType == 1 ) { + elemGT = EGT_point; + } else if ( vtkCellType == 3 ) { + elemGT = EGT_line_1; + } else if ( vtkCellType == 21 ) { + elemGT = EGT_line_2; + } else if ( vtkCellType == 5 ) { + elemGT = EGT_triangle_1; + } else if ( vtkCellType == 22 ) { + elemGT = EGT_triangle_2; + } else if ( vtkCellType == 10 ) { + elemGT = EGT_tetra_1; + } else if ( vtkCellType == 24 ) { + elemGT = EGT_tetra_2; + } else if ( vtkCellType == 9 ) { + elemGT = EGT_quad_1; + } else if ( vtkCellType == 30 ) { + elemGT = EGT_quad_21_interface; + } else if ( vtkCellType == 23 ) { + elemGT = EGT_quad_2; + } else if ( vtkCellType == 12 ) { + elemGT = EGT_hexa_1; + } else if ( vtkCellType == 25 ) { + elemGT = EGT_hexa_2; + } else if ( vtkCellType == 29 ) { + elemGT = EGT_hexa_27; + } else if ( vtkCellType == 13 ) { + elemGT = EGT_wedge_1; + } else if ( vtkCellType == 26 ) { + elemGT = EGT_wedge_2; + } else { + OOFEM_ERROR("unsupported vtk cell type %d", vtkCellType); + } + return elemGT; +} + +void VTKHDF5Reader::readMesh(UnstructuredGridField& f, TimeStep* tStep) +{ + int nParts, pOffset, pointOffset, cellOffset, connIdOffset, offsetOfOffset, nPoints, nCells, nconectivities; + this->getTimeStepOffsets (tStep, nParts, pOffset, pointOffset, cellOffset, connIdOffset, offsetOfOffset, nPoints, nCells, nconectivities); + H5::IntType itype(H5::PredType::NATIVE_UINT); + H5::DataType dtype(H5::PredType::NATIVE_DOUBLE); + H5::DataSet pointsDSet = topGroup->openDataSet( "Points" ); + H5::DataSet typesDSet = topGroup->openDataSet( "Types" ); + H5::DataSet connectivityDSet = topGroup->openDataSet( "Connectivity" ); + H5::DataSet offsetsDSet = topGroup->openDataSet( "Offsets" ); + + // read points + hsize_t dim2[]={nPoints,3}; + hsize_t offset2[] = {pointOffset, 0}; + double *points = new double[dim2[0]*3]; + this->readDataSet(pointsDSet, 2, dim2, offset2, dtype, points); + + // read cell types + hsize_t dim1[1]={nCells}; + hsize_t offset1[] = {cellOffset}; + unsigned int *types = new unsigned int[dim1[0]]; + this->readDataSet(typesDSet, 1, dim1, offset1, itype, types); + + // read cell connectivity + dim1[0]=nconectivities; + offset1[0] = connIdOffset; + unsigned int *connectivity = new unsigned int[dim1[0]]; + this->readDataSet(connectivityDSet, 1, dim1, offset1, itype, connectivity); + + // read cell offsets + dim1[0]=nCells+1; + offset1[0] = offsetOfOffset; + unsigned int *offsets = new unsigned int[dim1[0]]; + this->readDataSet(offsetsDSet, 1, dim1, offset1, itype, offsets); + + // set up the field mesh + f.initialize(nPoints, nCells); + // define mesh points + for (int i = 0; i < nPoints; i++) { + FloatArray coords(3); + coords.at(1) = points[i*3]; + coords.at(2) = points[i*3+1]; + coords.at(3) = points[i*3+2]; + f.addVertex(i+1, coords); //1-based + } + + // define mesh elements + for (int i = 0; i < nCells; i++) { + int type = types[i]; + int nNodes = offsets[i+1] - offsets[i]; + IntArray nodes(nNodes); + for (int j = 0; j < nNodes; j++) { + nodes[j] = connectivity[offsets[i]+j]+1; // 1-based + } + f.addCell(i+1, this->giveElementGeometryType(type), nodes) ; //1-based + } + + delete points; + delete types; + delete connectivity; + delete offsets; + + return; +} + +void VTKHDF5Reader::readField(UnstructuredGridField& field, TimeStep* tStep, const std::string &field_name) +{ + int nParts, pOffset, pointOffset, cellOffset, connIdOffset, offsetOfOffset, nPoints, nCells, nconectivities; + this->getTimeStepOffsets (tStep, nParts, pOffset, pointOffset, cellOffset, connIdOffset, offsetOfOffset, nPoints, nCells, nconectivities); + // open PointData group in topGroup + H5::Group* pointDataGroup = new H5::Group(topGroup->openGroup("PointData")); + // open field_name dataset in PointData group + if (pointDataGroup->nameExists(field_name.c_str())) { + H5::DataSet dSet = pointDataGroup->openDataSet(field_name.c_str()); + int nPoints = field.giveNumberOfVertices(); + // read field data + H5::DataType dtype(H5::PredType::NATIVE_DOUBLE); + hsize_t dim[2]; + dSet.getSpace().getSimpleExtentDims(dim); + dim[0] = nPoints; + double *fieldData = new double[nPoints*dim[1]]; + hsize_t offset2[] = {pointOffset, 0}; + this->readDataSet(dSet, 2, dim, offset2, dtype, fieldData); + + FloatArray valueArray((int)dim[1]); + for ( unsigned int inode = 0; inode < nPoints; inode++ ) { + for (unsigned int i=0; i +#include + +#ifdef __HDF_MODULE +#include "H5Cpp.h" +#endif + + +using namespace std; +namespace oofem { + +/** + * Represents VTK (Visualization Toolkit) hdf5 reader. It can read VTK hdf5 file format, Unstructured grid dataset. + * + */ +class OOFEM_EXPORT VTKHDF5Reader +{ +protected: + /// File name + std::string fileName; +#ifdef __HDF_MODULE + /// File + H5::H5File *file; + /// Top group + H5::Group *topGroup; + /// Steps group + H5::Group *stepsGroup; + /// Number of steps + unsigned int numSteps; + /// step values (times) + FloatArray stepValues; + /// Number of point data + unsigned int numPointData; + /// Number of cell data + unsigned int numCellData; +#endif +public: + /// Constructor. Creates empty Output Manager. By default all components are selected. + VTKHDF5Reader(); + /// Destructor + virtual ~VTKHDF5Reader(); + + void initialize(std::string &fileName) ; + void finalize() ; + void readMesh(UnstructuredGridField&, TimeStep* tStep); + void readField(UnstructuredGridField&, TimeStep* tStep, const std::string &field_name); +protected: +#ifdef __HDF_MODULE + void readDataSet (H5::DataSet& dset, int rank, hsize_t* dim, hsize_t* offset, H5::DataType type, void* data); + void getTimeStepOffsets(TimeStep* tStep, int& nParts, int& pOffset, int& pointOffset, int& cellOffset, int& connIdOffset, int &offsetOfOffset, int& nPoints, int &nCells, int& nconectivities); + Element_Geometry_Type giveElementGeometryType(int vtkCellType); +#endif + +}; + +} // end namespace oofem +#endif // vtkhdf5exportmodule_h diff --git a/src/oofemlib/vtkxfemexportmodule.C b/src/oofemlib/vtkxfemexportmodule.C index a88bbeacb..4e3dafbbe 100644 --- a/src/oofemlib/vtkxfemexportmodule.C +++ b/src/oofemlib/vtkxfemexportmodule.C @@ -114,7 +114,7 @@ VTKXMLXFemExportModule::giveOutputStream(TimeStep *tStep) } void -VTKXMLXFemExportModule::exportIntVars(ExportRegion &vtkPiece, Set& region, int field, int enrItIndex, IntArray& internalVarsToExport, NodalRecoveryModel& smoother, TimeStep *tStep) +VTKXMLXFemExportModule::exportIntVars2(ExportRegion &vtkPiece, Set& region, int field, int enrItIndex, IntArray& internalVarsToExport, NodalRecoveryModel& smoother, TimeStep *tStep) { Domain *d = emodel->giveDomain(1); FloatArray answer; @@ -321,7 +321,7 @@ VTKXMLXFemExportModule::doOutput(TimeStep *tStep, bool forcedOutput) for ( int enrItIndex = 1; enrItIndex <= nEnrIt; enrItIndex++ ) { // Fills a data struct (VTKPiece) with all the necessary data. //this->setupVTKPiece(this->defaultVTKPiece, tStep, *region); - this->exportIntVars(this->defaultVTKPiece, *region, field, enrItIndex, internalVarsToExport, *smoother, tStep); + this->exportIntVars2(this->defaultVTKPiece, *region, field, enrItIndex, internalVarsToExport, *smoother, tStep); // Write the VTK piece to file. anyPieceNonEmpty +=this->writeXFEMVars(this->defaultVTKPiece, field, enrItIndex); } diff --git a/src/oofemlib/vtkxfemexportmodule.h b/src/oofemlib/vtkxfemexportmodule.h index 83cdf824c..3ccf8862f 100644 --- a/src/oofemlib/vtkxfemexportmodule.h +++ b/src/oofemlib/vtkxfemexportmodule.h @@ -99,7 +99,7 @@ class OOFEM_EXPORT VTKXMLXFemExportModule : public VTKXMLExportModule bool writeXFEMVars(ExportRegion &vtkPiece, int field, int enrItIndex); void getNodalVariableFromXFEMST(FloatArray &answer, Node *node, TimeStep *tStep, XFEMStateType xfemstype, Set ®ion, EnrichmentItem *ei); - void exportIntVars(ExportRegion &vtkPiece, Set& region, int field, int enrItIndex, IntArray& internalVarsToExport, NodalRecoveryModel& smoother, TimeStep *tStep); + void exportIntVars2(ExportRegion &vtkPiece, Set& region, int field, int enrItIndex, IntArray& internalVarsToExport, NodalRecoveryModel& smoother, TimeStep *tStep); void giveDataHeaders(std::string &pointHeader, std::string &cellHeader) override; // returns the headers }; diff --git a/src/oofemlib/weakperiodicbc.C b/src/oofemlib/weakperiodicbc.C index 135a4eea0..0ac1a3430 100644 --- a/src/oofemlib/weakperiodicbc.C +++ b/src/oofemlib/weakperiodicbc.C @@ -196,7 +196,7 @@ double WeakPeriodicBoundaryCondition :: computeProjectionCoefficient(int vIndex, Element *thisElement = this->domain->giveElement( element [ thisSide ].at(ielement) ); FEInterpolation *geoInterpolation = thisElement->giveInterpolation(); - std :: unique_ptr< IntegrationRule >iRule(geoInterpolation->giveBoundaryIntegrationRule(thisOrder, side [ thisSide ].at(ielement))); + std :: unique_ptr< IntegrationRule >iRule(geoInterpolation->giveBoundaryIntegrationRule(thisOrder, side [ thisSide ].at(ielement), thisElement->giveGeometryType())); for ( GaussPoint *gp: *iRule ) { @@ -425,7 +425,7 @@ void WeakPeriodicBoundaryCondition :: computeElementTangent(FloatMatrix &B, Elem { OOFEM_ERROR("Function obsolete"); - +#if 0 FloatArray gcoords; FEInterpolation *geoInterpolation = e->giveInterpolation(); @@ -433,12 +433,12 @@ void WeakPeriodicBoundaryCondition :: computeElementTangent(FloatMatrix &B, Elem // Use correct interpolation for the dofid on which the condition is applied FEInterpolation *interpolation = e->giveInterpolation( ( DofIDItem ) dofids[0] ); - auto bnodes = interpolation->boundaryGiveNodes(boundary); + auto bnodes = interpolation->boundaryGiveNodes(boundary, e->giveGeometryType()); B.resize(bnodes.giveSize(), ndof); B.zero(); - std :: unique_ptr< IntegrationRule >iRule(geoInterpolation->giveBoundaryIntegrationRule(orderOfPolygon, boundary)); + std :: unique_ptr< IntegrationRule >iRule(geoInterpolation->giveBoundaryIntegrationRule(orderOfPolygon, boundary, e->giveGeometryType())); for ( GaussPoint *gp: *iRule ) { const FloatArray &lcoords = gp->giveNaturalCoordinates(); @@ -476,6 +476,7 @@ void WeakPeriodicBoundaryCondition :: computeElementTangent(FloatMatrix &B, Elem } } } +#endif } void WeakPeriodicBoundaryCondition :: assemble(SparseMtrx &answer, TimeStep *tStep, CharType type, const UnknownNumberingScheme &r_s, const UnknownNumberingScheme &c_s, double scale, void* lock) @@ -508,7 +509,7 @@ void WeakPeriodicBoundaryCondition :: assemble(SparseMtrx &answer, TimeStep *tSt FEInterpolation *interpolation = thisElement->giveInterpolation( ( DofIDItem ) dofids[0] ); FEInterpolation *geoInterpolation = thisElement->giveInterpolation(); - auto bNodes = interpolation->boundaryGiveNodes(side [ thisSide ].at(ielement)); + auto bNodes = interpolation->boundaryGiveNodes(side [ thisSide ].at(ielement), thisElement->giveGeometryType()); thisElement->giveBoundaryLocationArray(r_sideLoc, bNodes, dofids, r_s); thisElement->giveBoundaryLocationArray(c_sideLoc, bNodes, dofids, c_s); @@ -516,7 +517,7 @@ void WeakPeriodicBoundaryCondition :: assemble(SparseMtrx &answer, TimeStep *tSt B.resize(bNodes.giveSize()*ndofids, ndofids*tcount); B.zero(); - std :: unique_ptr< IntegrationRule >iRule(geoInterpolation->giveBoundaryIntegrationRule(orderOfPolygon, boundary)); + std :: unique_ptr< IntegrationRule >iRule(geoInterpolation->giveBoundaryIntegrationRule(orderOfPolygon, boundary, thisElement->giveGeometryType())); for ( auto &gp: *iRule ) { auto const &lcoords = gp->giveNaturalCoordinates(); @@ -695,7 +696,7 @@ WeakPeriodicBoundaryCondition :: giveInternalForcesVector(FloatArray &answer, Ti FEInterpolation *interpolation = thisElement->giveInterpolation( ( DofIDItem ) dofids[0] ); FEInterpolation *geoInterpolation = thisElement->giveInterpolation(); - auto bNodes = interpolation->boundaryGiveNodes(boundary); + auto bNodes = interpolation->boundaryGiveNodes(boundary, thisElement->giveGeometryType()); thisElement->giveBoundaryLocationArray(sideLocation, bNodes, dofids, s, &masterDofIDs); thisElement->computeBoundaryVectorOf(bNodes, dofids, VM_Total, tStep, a); @@ -705,7 +706,7 @@ WeakPeriodicBoundaryCondition :: giveInternalForcesVector(FloatArray &answer, Ti B.resize(bNodes.giveSize(), ndof); B.zero(); - std :: unique_ptr< IntegrationRule >iRule(geoInterpolation->giveBoundaryIntegrationRule(orderOfPolygon, boundary)); + std :: unique_ptr< IntegrationRule >iRule(geoInterpolation->giveBoundaryIntegrationRule(orderOfPolygon, boundary, thisElement->giveGeometryType())); // Where we test with velocity vProd.resize(bNodes.giveSize()*dofids.giveSize()); @@ -824,7 +825,7 @@ WeakPeriodicBoundaryCondition :: giveExternalForcesVector(FloatArray &answer, Ti FEInterpolation *geoInterpolation = thisElement->giveInterpolation(); - std :: unique_ptr< IntegrationRule >iRule(geoInterpolation->giveBoundaryIntegrationRule(orderOfPolygon, side [ thisSide ].at(ielement) )); + std :: unique_ptr< IntegrationRule >iRule(geoInterpolation->giveBoundaryIntegrationRule(orderOfPolygon, side [ thisSide ].at(ielement), thisElement->giveGeometryType() )); for ( auto gp: *iRule ) { diff --git a/src/oofemlib/xfem/XFEMDebugTools.h b/src/oofemlib/xfem/XFEMDebugTools.h index 550f078cb..2a6243a76 100644 --- a/src/oofemlib/xfem/XFEMDebugTools.h +++ b/src/oofemlib/xfem/XFEMDebugTools.h @@ -8,7 +8,7 @@ #ifndef XFEMDEBUGTOOLS_H_ #define XFEMDEBUGTOOLS_H_ -#include "oofemcfg.h" +#include "oofemenv.h" #include "geometry.h" #include diff --git a/src/oofemlib/xfem/delaunay.h b/src/oofemlib/xfem/delaunay.h index 020bdd1cf..3131b8736 100644 --- a/src/oofemlib/xfem/delaunay.h +++ b/src/oofemlib/xfem/delaunay.h @@ -35,7 +35,7 @@ #ifndef delaunay_h #define delaunay_h -#include "oofemcfg.h" +#include "oofemenv.h" #include diff --git a/src/oofemlib/xfem/enrichmentfronts/enrichmentfront.h b/src/oofemlib/xfem/enrichmentfronts/enrichmentfront.h index 542c68a18..c1f81ac02 100644 --- a/src/oofemlib/xfem/enrichmentfronts/enrichmentfront.h +++ b/src/oofemlib/xfem/enrichmentfronts/enrichmentfront.h @@ -35,7 +35,7 @@ #ifndef ENRICHMENTFRONT_H_ #define ENRICHMENTFRONT_H_ -#include "oofemcfg.h" +#include "oofemenv.h" #include #include "inputrecord.h" #include "xfem/tipinfo.h" diff --git a/src/oofemlib/xfem/enrichmentfronts/enrichmentfrontcohesivebranchfunconeel.h b/src/oofemlib/xfem/enrichmentfronts/enrichmentfrontcohesivebranchfunconeel.h index a43e94573..dff55935f 100644 --- a/src/oofemlib/xfem/enrichmentfronts/enrichmentfrontcohesivebranchfunconeel.h +++ b/src/oofemlib/xfem/enrichmentfronts/enrichmentfrontcohesivebranchfunconeel.h @@ -37,7 +37,7 @@ #define _IFT_EnrFrontCohesiveBranchFuncOneEl_Name "enrfrontcohesivebranchfunconeel" -#include "oofemcfg.h" +#include "oofemenv.h" #include #include "inputrecord.h" #include "xfem/enrichmentfronts/enrichmentfront.h" diff --git a/src/oofemlib/xfem/enrichmentfronts/enrichmentfrontdonothing.h b/src/oofemlib/xfem/enrichmentfronts/enrichmentfrontdonothing.h index a508cb971..244a039cf 100644 --- a/src/oofemlib/xfem/enrichmentfronts/enrichmentfrontdonothing.h +++ b/src/oofemlib/xfem/enrichmentfronts/enrichmentfrontdonothing.h @@ -37,7 +37,7 @@ #define _IFT_EnrFrontDoNothing_Name "enrfrontdonothing" -#include "oofemcfg.h" +#include "oofemenv.h" #include #include "inputrecord.h" #include "xfem/enrichmentfronts/enrichmentfront.h" diff --git a/src/oofemlib/xfem/enrichmentfronts/enrichmentfrontextend.h b/src/oofemlib/xfem/enrichmentfronts/enrichmentfrontextend.h index 677f3ea39..d17740a88 100644 --- a/src/oofemlib/xfem/enrichmentfronts/enrichmentfrontextend.h +++ b/src/oofemlib/xfem/enrichmentfronts/enrichmentfrontextend.h @@ -37,7 +37,7 @@ #define _IFT_EnrFrontExtend_Name "enrfrontextend" -#include "oofemcfg.h" +#include "oofemenv.h" #include #include "inputrecord.h" #include "xfem/enrichmentfronts/enrichmentfront.h" diff --git a/src/oofemlib/xfem/enrichmentfronts/enrichmentfrontlinbranchfunconeel.h b/src/oofemlib/xfem/enrichmentfronts/enrichmentfrontlinbranchfunconeel.h index 576b45fb5..b281bc238 100644 --- a/src/oofemlib/xfem/enrichmentfronts/enrichmentfrontlinbranchfunconeel.h +++ b/src/oofemlib/xfem/enrichmentfronts/enrichmentfrontlinbranchfunconeel.h @@ -37,7 +37,7 @@ #define _IFT_EnrFrontLinearBranchFuncOneEl_Name "enrfrontlinearbranchfunconeel" -#include "oofemcfg.h" +#include "oofemenv.h" #include #include "inputrecord.h" #include "xfem/enrichmentfronts/enrichmentfront.h" diff --git a/src/oofemlib/xfem/enrichmentfronts/enrichmentfrontlinbranchfuncradius.h b/src/oofemlib/xfem/enrichmentfronts/enrichmentfrontlinbranchfuncradius.h index 087294b00..2e0c2124b 100644 --- a/src/oofemlib/xfem/enrichmentfronts/enrichmentfrontlinbranchfuncradius.h +++ b/src/oofemlib/xfem/enrichmentfronts/enrichmentfrontlinbranchfuncradius.h @@ -38,7 +38,7 @@ #define _IFT_EnrFrontLinearBranchFuncRadius_Name "enrfrontlinearbranchfuncradius" #define _IFT_EnrFrontLinearBranchFuncRadius_Radius "radius" -#include "oofemcfg.h" +#include "oofemenv.h" #include #include "inputrecord.h" #include "xfem/enrichmentfronts/enrichmentfront.h" diff --git a/src/oofemlib/xfem/enrichmentfronts/enrichmentfrontreducefront.h b/src/oofemlib/xfem/enrichmentfronts/enrichmentfrontreducefront.h index 7718beed3..25621782c 100644 --- a/src/oofemlib/xfem/enrichmentfronts/enrichmentfrontreducefront.h +++ b/src/oofemlib/xfem/enrichmentfronts/enrichmentfrontreducefront.h @@ -35,7 +35,7 @@ #ifndef ENRICHMENTFRONTREDUCEFRONT_H_ #define ENRICHMENTFRONTREDUCEFRONT_H_ -#include "oofemcfg.h" +#include "oofemenv.h" #include #include "inputrecord.h" #include "xfem/enrichmentfronts/enrichmentfront.h" diff --git a/src/oofemlib/xfem/geometrybasedei.C b/src/oofemlib/xfem/geometrybasedei.C index 9d1ae88d4..fe8fde949 100644 --- a/src/oofemlib/xfem/geometrybasedei.C +++ b/src/oofemlib/xfem/geometrybasedei.C @@ -290,10 +290,10 @@ void GeometryBasedEI :: updateNodeEnrMarker(XfemManager &ixFemMan) if ( minPhi * maxPhi < mLevelSetTol ) { // If the level set function changes sign within the element. // Count the number of element edges intersected by the interface //int numEdges = nElNodes; // TODO: Is this assumption always true? - int numEdges = el->giveInterpolation()->giveNumberOfEdges(); //JIM + int numEdges = el->giveInterpolation()->giveNumberOfEdges(el->giveGeometryType()); //JIM for ( int edgeIndex = 1; edgeIndex <= numEdges; edgeIndex++ ) { - const auto &bNodes = el->giveInterpolation()->boundaryGiveNodes(edgeIndex); + const auto &bNodes = el->giveInterpolation()->boundaryGiveNodes(edgeIndex, el->giveGeometryType()); int niLoc = bNodes.at(1); int niGlob = el->giveNode(niLoc)->giveGlobalNumber(); @@ -615,10 +615,10 @@ void GeometryBasedEI :: computeIntersectionPoints(std :: vector< FloatArray > &o // int numEdges = element->giveNumberOfBoundarySides(); //int numEdges = element->giveNumberOfNodes(); // TODO: Is this assumption always true? - int numEdges = element->giveInterpolation()->giveNumberOfEdges(); + int numEdges = element->giveInterpolation()->giveNumberOfEdges(element->giveGeometryType()); for ( int edgeIndex = 1; edgeIndex <= numEdges; edgeIndex++ ) { - const auto &bNodes = element->giveInterpolation()->boundaryGiveNodes(edgeIndex); + const auto &bNodes = element->giveInterpolation()->boundaryGiveNodes(edgeIndex, element->giveGeometryType()); int nsLoc = bNodes.at(1); int nsGlob = element->giveNode(nsLoc)->giveGlobalNumber(); diff --git a/src/oofemlib/xfem/nucleationcriterion.C b/src/oofemlib/xfem/nucleationcriterion.C index 4252e5d35..08f0b1dc5 100644 --- a/src/oofemlib/xfem/nucleationcriterion.C +++ b/src/oofemlib/xfem/nucleationcriterion.C @@ -53,9 +53,10 @@ NucleationCriterion::~NucleationCriterion() { } std::vector> NucleationCriterion::nucleateEnrichmentItems() { OOFEM_ERROR("Not implemented.") - +/* std::vector> eiList; return eiList; +*/ } void NucleationCriterion::initializeFrom(InputRecord &ir) diff --git a/src/oofemlib/xfem/patchintegrationrule.C b/src/oofemlib/xfem/patchintegrationrule.C index 251e2b780..68ef55ec7 100644 --- a/src/oofemlib/xfem/patchintegrationrule.C +++ b/src/oofemlib/xfem/patchintegrationrule.C @@ -130,7 +130,7 @@ PatchIntegrationRule :: SetUpPointsOnTriangle(int nPoints, MaterialMode mode) mTriInterp.local2global( global, gp->giveNaturalCoordinates(), - FEIVertexListGeometryWrapper(coords) ); + FEIVertexListGeometryWrapper(coords, EGT_triangle_1) ); newGPCoord.push_back(global); @@ -251,7 +251,7 @@ PatchIntegrationRule :: SetUpPointsOnWedge(int nPointsTri, int nPointsDepth, Mat // Compute global gp coordinate in the element from local gp coord in the sub triangle FloatArray global; mTriInterp.local2global( global, gp->giveNaturalCoordinates(), - FEIVertexListGeometryWrapper(gCoords) ); + FEIVertexListGeometryWrapper(gCoords, EGT_triangle_1) ); // Compute local gp coordinate in the element from global gp coord in the element diff --git a/src/oofemlib/xfem/propagationlaw.h b/src/oofemlib/xfem/propagationlaw.h index 0857f999d..9c9a078c1 100644 --- a/src/oofemlib/xfem/propagationlaw.h +++ b/src/oofemlib/xfem/propagationlaw.h @@ -36,7 +36,7 @@ #ifndef PROPAGATIONLAW_H_ #define PROPAGATIONLAW_H_ -#include "oofemcfg.h" +#include "oofemenv.h" #include "inputrecord.h" #define _IFT_PLDoNothing_Name "propagationlawdonothing" diff --git a/src/oofemlib/xfem/xfemelementinterface.C b/src/oofemlib/xfem/xfemelementinterface.C index 2fc9c98d0..615af84d9 100644 --- a/src/oofemlib/xfem/xfemelementinterface.C +++ b/src/oofemlib/xfem/xfemelementinterface.C @@ -535,14 +535,14 @@ void XfemElementInterface :: XfemElementInterface_prepareNodesForDelaunay(std :: foundTip = true; tipCoord.resizeWithValues(dim); } - int nEdges = this->element->giveInterpolation()->giveNumberOfEdges(); + int nEdges = this->element->giveInterpolation()->giveNumberOfEdges(element->giveGeometryType()); if ( foundTip ) { oPointPartitions.clear(); // Divide into subdomains int triPassed = 0; for ( int i = 1; i <= nEdges; i++ ) { - const auto &bNodes = this->element->giveInterpolation()->boundaryGiveNodes(i); + const auto &bNodes = this->element->giveInterpolation()->boundaryGiveNodes(i, element->giveGeometryType()); if ( bNodes.giveSize() == 2 ) { diff --git a/src/oofemlib/xfem/xfemmanager.C b/src/oofemlib/xfem/xfemmanager.C index 02df53aaf..cd0c969a9 100644 --- a/src/oofemlib/xfem/xfemmanager.C +++ b/src/oofemlib/xfem/xfemmanager.C @@ -113,7 +113,7 @@ bool XfemManager :: isElementEnriched(const Element *elem) #else // An element is enriched if one of its nodes is enriched. for ( int n: elem->giveDofManArray() ) { - if ( mNodeEnrichmentItemIndices [ n - 1 ].size() > 0 ) { + if ( mNodeEnrichmentItemIndices.size() && mNodeEnrichmentItemIndices [ n - 1 ].size() > 0 ) { return true; } } @@ -474,7 +474,8 @@ void XfemManager :: nucleateEnrichmentItems(bool &oNewItemsWereNucleated) // printf("Entering XfemManager :: nucleateEnrichmentItems\n"); for(auto &nucCrit : mNucleationCriteria) { - std::vector> eiList = std::move(nucCrit->nucleateEnrichmentItems()); + //std::vector> eiList = std::move(nucCrit->nucleateEnrichmentItems()); + std::vector> eiList = nucCrit->nucleateEnrichmentItems(); if(eiList.size() > 0) { // printf("eiList.size(): %lu\n", eiList.size() ); diff --git a/src/oofemlib/xfem/xfemmanager.h b/src/oofemlib/xfem/xfemmanager.h index bf8041b9d..9db70d9b9 100644 --- a/src/oofemlib/xfem/xfemmanager.h +++ b/src/oofemlib/xfem/xfemmanager.h @@ -35,7 +35,7 @@ #ifndef xfemmanager_h #define xfemmanager_h -#include "oofemcfg.h" +#include "oofemenv.h" #include "datareader.h" #include "inputrecord.h" #include "contextioresulttype.h" diff --git a/src/oofemlib/zznodalrecoverymodel.C b/src/oofemlib/zznodalrecoverymodel.C index 0d49222b5..2ed57def6 100644 --- a/src/oofemlib/zznodalrecoverymodel.C +++ b/src/oofemlib/zznodalrecoverymodel.C @@ -48,7 +48,7 @@ #include #include -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE #include "problemcomm.h" #include "communicator.h" #endif @@ -80,7 +80,7 @@ ZZNodalRecoveryModel :: recoverValues(Set elementSet, InternalStateType type, Ti return 1; } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( this->domain->giveEngngModel()->isParallel() ) { this->initCommMaps(); } @@ -155,7 +155,7 @@ ZZNodalRecoveryModel :: recoverValues(Set elementSet, InternalStateType type, Ti } } // end assemble element contributions -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( this->domain->giveEngngModel()->isParallel() ) { this->exchangeDofManValues(lhs, rhs, regionNodalNumbers); } @@ -243,7 +243,7 @@ ZZNodalRecoveryModelInterface :: ZZNodalRecoveryMI_computeNNMatrix(FloatArray &a // The size of N mtrx is (nstresses, nnodes*nstreses) // Definition : sigmaVector = N * nodalSigmaVector // - double volume = 0.0; + //double volume = 0.0; FloatMatrix fullAnswer; FloatArray n; FEInterpolation *interpol = element->giveInterpolation(); @@ -256,14 +256,14 @@ ZZNodalRecoveryModelInterface :: ZZNodalRecoveryMI_computeNNMatrix(FloatArray &a int size = element->giveNumberOfDofManagers(); fullAnswer.resize(size, size); fullAnswer.zero(); - double pok = 0.0; + //double pok = 0.0; for ( GaussPoint *gp: *iRule ) { double dV = element->computeVolumeAround(gp); interpol->evalN( n, gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(element) ); fullAnswer.plusDyadSymmUpper(n, dV); - pok += ( n.at(1) * dV ); ///@todo What is this? Completely unused. - volume += dV; + //pok += ( n.at(1) * dV ); ///@todo What is this? Completely unused. + //volume += dV; } @@ -280,12 +280,12 @@ ZZNodalRecoveryModelInterface :: ZZNodalRecoveryMI_computeNNMatrix(FloatArray &a } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE void ZZNodalRecoveryModel :: initCommMaps() { - #ifdef __PARALLEL_MODE + #ifdef __MPI_PARALLEL_MODE if ( initCommMap ) { EngngModel *emodel = domain->giveEngngModel(); commBuff = new CommunicatorBuff(emodel->giveNumberOfProcesses(), CBT_dynamic); diff --git a/src/oofemlib/zznodalrecoverymodel.h b/src/oofemlib/zznodalrecoverymodel.h index 9ae4cabdf..c07ddec12 100644 --- a/src/oofemlib/zznodalrecoverymodel.h +++ b/src/oofemlib/zznodalrecoverymodel.h @@ -85,7 +85,7 @@ class OOFEM_EXPORT ZZNodalRecoveryModel : public NodalRecoveryModel */ void initRegionMap(IntArray ®ionMap, InternalStateType type); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE void initCommMaps(); void exchangeDofManValues(FloatArray &lhs, FloatMatrix &rhs, IntArray &rn); int packSharedDofManData(parallelStruct *s, ProcessCommunicator &processComm); diff --git a/src/sm/CMakeLists.txt b/src/sm/CMakeLists.txt index e289ee5a5..adfe852fc 100644 --- a/src/sm/CMakeLists.txt +++ b/src/sm/CMakeLists.txt @@ -41,7 +41,7 @@ set (sm_emodel set (sm_loads Loads/tf1.C Loads/usrdeftempfield.C - Loads/foreigntempfieldload.C + Loads/externaltempfieldload.C Loads/rotatingboundary.C Loads/constantpressureload.C Loads/structtemperatureload.C @@ -124,7 +124,7 @@ set (sm ${sm_quasicontinuum} ) -if (USE_PARALLEL) +if (USE_MPI_PARALLEL) list (APPEND sm ${sm_parallel}) endif () diff --git a/src/sm/Contact/cdefnode2node.h b/src/sm/Contact/cdefnode2node.h index 9643dbae5..14bceec23 100644 --- a/src/sm/Contact/cdefnode2node.h +++ b/src/sm/Contact/cdefnode2node.h @@ -66,8 +66,8 @@ class ContactMaterial; // write this class OOFEM_EXPORT ContactDefinitionNode2Node : public ContactDefinition { private: - double epsN; - double epsT; // these should be 'contactmaterial' par + //double epsN; + //double epsT; // these should be 'contactmaterial' par public: diff --git a/src/sm/Contact/celnode2node.h b/src/sm/Contact/celnode2node.h index 2d5198efe..3c5e0753f 100644 --- a/src/sm/Contact/celnode2node.h +++ b/src/sm/Contact/celnode2node.h @@ -103,7 +103,7 @@ class OOFEM_EXPORT Node2NodeContactL : public Node2NodeContact private: DofManager *masterNode; DofManager *slaveNode; - int lagrangeId; // dof Id associated with the Lagrange multiplier + //int lagrangeId; // dof Id associated with the Lagrange multiplier // should be set by input: double area; // The area associated with the node (default = 1)- in order to represent some physical dimension. diff --git a/src/sm/CrossSections/fiberedcs.C b/src/sm/CrossSections/fiberedcs.C index 34720b333..9b34037b8 100644 --- a/src/sm/CrossSections/fiberedcs.C +++ b/src/sm/CrossSections/fiberedcs.C @@ -50,7 +50,6 @@ FloatArrayF< 6 > FiberedCrossSection::giveRealStress_3d(const FloatArrayF< 6 > &strain, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not supported"); - return zeros< 6 >(); } @@ -58,7 +57,6 @@ FloatArrayF< 4 > FiberedCrossSection::giveRealStress_PlaneStrain(const FloatArrayF< 4 > &strain, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not supported"); - return zeros< 4 >(); } @@ -66,7 +64,6 @@ FloatArrayF< 3 > FiberedCrossSection::giveRealStress_PlaneStress(const FloatArrayF< 3 > &strain, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not supported"); - return zeros< 3 >(); } @@ -74,7 +71,6 @@ FloatArrayF< 1 > FiberedCrossSection::giveRealStress_1d(const FloatArrayF< 1 > &strain, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not supported"); - return zeros< 1 >(); } @@ -82,7 +78,6 @@ FloatArrayF< 2 > FiberedCrossSection::giveRealStress_Warping(const FloatArrayF< 2 > &strain, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not supported\n"); - return zeros< 2 >(); } @@ -92,7 +87,6 @@ FloatArrayF< 9 > FiberedCrossSection::giveFirstPKStress_3d(const FloatArrayF< 9 > &vF, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not supported"); - return zeros< 9 >(); } @@ -100,7 +94,6 @@ FloatArrayF< 5 > FiberedCrossSection::giveFirstPKStress_PlaneStrain(const FloatArrayF< 5 > &vF, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not supported"); - return zeros< 5 >(); } @@ -108,7 +101,6 @@ FloatArrayF< 4 > FiberedCrossSection::giveFirstPKStress_PlaneStress(const FloatArrayF< 4 > &vF, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not supported"); - return zeros< 4 >(); } @@ -116,7 +108,6 @@ FloatArrayF< 1 > FiberedCrossSection::giveFirstPKStress_1d(const FloatArrayF< 1 > &vF, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not supported"); - return zeros< 1 >(); } @@ -126,7 +117,6 @@ FloatMatrixF< 6, 6 > FiberedCrossSection::giveStiffnessMatrix_3d(MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not supported"); - return FloatMatrixF< 6, 6 >(); } @@ -134,7 +124,6 @@ FloatMatrixF< 3, 3 > FiberedCrossSection::giveStiffnessMatrix_PlaneStress(MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not supported"); - return FloatMatrixF< 3, 3 >(); } @@ -142,7 +131,6 @@ FloatMatrixF< 4, 4 > FiberedCrossSection::giveStiffnessMatrix_PlaneStrain(MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not supported"); - return FloatMatrixF< 4, 4 >(); } @@ -150,7 +138,6 @@ FloatMatrixF< 1, 1 > FiberedCrossSection::giveStiffnessMatrix_1d(MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not supported"); - return FloatMatrixF< 1, 1 >(); } @@ -170,7 +157,6 @@ FloatMatrixF< 9, 9 > FiberedCrossSection::giveStiffnessMatrix_dPdF_3d(MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not supported"); - return FloatMatrixF< 9, 9 >(); } @@ -178,7 +164,6 @@ FloatMatrixF< 4, 4 > FiberedCrossSection::giveStiffnessMatrix_dPdF_PlaneStress(MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not supported"); - return FloatMatrixF< 4, 4 >(); } @@ -186,7 +171,6 @@ FloatMatrixF< 5, 5 > FiberedCrossSection::giveStiffnessMatrix_dPdF_PlaneStrain(MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not supported"); - return FloatMatrixF< 5, 5 >(); } @@ -194,7 +178,6 @@ FloatMatrixF< 1, 1 > FiberedCrossSection::giveStiffnessMatrix_dPdF_1d(MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not supported"); - return FloatMatrixF< 1, 1 >(); } @@ -203,7 +186,6 @@ FloatArrayF< 3 > FiberedCrossSection::giveGeneralizedStress_Beam2d(const FloatArrayF< 3 > &strain, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not supported"); - return zeros< 3 >(); } @@ -265,7 +247,6 @@ FloatArrayF< 5 > FiberedCrossSection::giveGeneralizedStress_Plate(const FloatArrayF< 5 > &strain, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not supported"); - return zeros< 5 >(); } @@ -273,14 +254,12 @@ FloatArrayF< 8 > FiberedCrossSection::giveGeneralizedStress_Shell(const FloatArrayF< 8 > &strain, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not supported"); - return zeros< 8 >(); } FloatArrayF< 9 > FiberedCrossSection::giveGeneralizedStress_ShellRot(const FloatArrayF< 9 > &strain, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not supported"); - return zeros< 9 >(); } @@ -288,14 +267,12 @@ FloatArrayF< 4 > FiberedCrossSection::giveGeneralizedStress_MembraneRot(const FloatArrayF< 4 > &strain, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not supported in given cross-section (yet)."); - return zeros< 4 >(); } FloatArrayF< 3 > FiberedCrossSection::giveGeneralizedStress_PlateSubSoil(const FloatArrayF< 3 > &strain, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not supported in given cross-section."); - return zeros< 3 >(); } void @@ -323,7 +300,6 @@ FloatMatrixF< 3, 3 > FiberedCrossSection::give2dBeamStiffMtrx(MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not implemented"); - return FloatMatrixF< 3, 3 >(); } @@ -379,7 +355,6 @@ FloatMatrixF< 5, 5 > FiberedCrossSection::give2dPlateStiffMtrx(MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not implemented"); - return FloatMatrixF< 5, 5 >(); } @@ -387,28 +362,24 @@ FloatMatrixF< 8, 8 > FiberedCrossSection::give3dShellStiffMtrx(MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not implemented"); - return FloatMatrixF< 8, 8 >(); } FloatMatrixF< 9, 9 > FiberedCrossSection::give3dShellRotStiffMtrx(MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not implemented"); - return FloatMatrixF< 9, 9 >(); } FloatMatrixF< 4, 4 > FiberedCrossSection::giveMembraneRotStiffMtrx(MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not implemented"); - return FloatMatrixF< 4, 4 >(); } FloatMatrixF< 3, 3 > FiberedCrossSection::give2dPlateSubSoilStiffMtrx(MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not supported"); - return FloatMatrixF< 3, 3 >(); } @@ -640,8 +611,6 @@ FiberedCrossSection::giveCorrespondingSlaveMaterialMode(MaterialMode masterMode) } else { throw std::runtime_error("Unsupported mode"); } - - return _Unknown; } diff --git a/src/sm/CrossSections/fiberedcs.h b/src/sm/CrossSections/fiberedcs.h index 39a1b2624..69ed6aad1 100644 --- a/src/sm/CrossSections/fiberedcs.h +++ b/src/sm/CrossSections/fiberedcs.h @@ -136,7 +136,6 @@ class FiberedCrossSection : public StructuralCrossSection double give(int aProperty, GaussPoint *gp) const override { OOFEM_ERROR("not implemented yet"); - return 0.0; } FloatArray *imposeStressConstrainsOnGradient(GaussPoint *gp, FloatArray *gradientStressVector3d) override; FloatArray *imposeStrainConstrainsOnGradient(GaussPoint *gp, FloatArray *gradientStrainVector3d) override; @@ -165,19 +164,16 @@ class FiberedCrossSection : public StructuralCrossSection int packUnknowns(DataStream &buff, TimeStep *tStep, GaussPoint *ip) override { OOFEM_ERROR("not implemented"); - return 0; } int unpackAndUpdateUnknowns(DataStream &buff, TimeStep *tStep, GaussPoint *ip) override { OOFEM_ERROR("not implemented"); - return 0; } int estimatePackSize(DataStream &buff, GaussPoint *ip) override { OOFEM_ERROR("not implemented"); - return 0; } diff --git a/src/sm/CrossSections/layeredcrosssection.C b/src/sm/CrossSections/layeredcrosssection.C index 3e2ece540..66938f38d 100644 --- a/src/sm/CrossSections/layeredcrosssection.C +++ b/src/sm/CrossSections/layeredcrosssection.C @@ -93,7 +93,6 @@ LayeredCrossSection::giveRealStress_3d(const FloatArrayF< 6 > &strain, GaussPoin } } else { OOFEM_ERROR("Only cubes and wedges are meaningful for layered cross-sections"); - return zeros< 6 >(); } } @@ -110,7 +109,6 @@ FloatArrayF< 4 > LayeredCrossSection::giveRealStress_PlaneStrain(const FloatArrayF< 4 > &strain, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not supported"); - return zeros< 4 >(); } @@ -164,7 +162,6 @@ FloatArrayF< 1 > LayeredCrossSection::giveRealStress_1d(const FloatArrayF< 1 > &strain, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not supported"); - return zeros< 1 >(); } @@ -172,7 +169,6 @@ FloatArrayF< 2 > LayeredCrossSection::giveRealStress_Warping(const FloatArrayF< 2 > &strain, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not supported"); - return zeros< 2 >(); } @@ -238,7 +234,6 @@ FloatMatrixF< 4, 4 > LayeredCrossSection::giveStiffnessMatrix_PlaneStrain(MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not supported"); - return FloatMatrixF< 4, 4 >(); } @@ -246,7 +241,6 @@ FloatMatrixF< 1, 1 > LayeredCrossSection::giveStiffnessMatrix_1d(MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not supported"); - return FloatMatrixF< 1, 1 >(); } @@ -311,7 +305,6 @@ FloatArrayF< 6 > LayeredCrossSection::giveGeneralizedStress_Beam3d(const FloatArrayF< 6 > &strain, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not supported"); - return zeros< 6 >(); } @@ -562,7 +555,6 @@ FloatArrayF< 3 > LayeredCrossSection::giveGeneralizedStress_PlateSubSoil(const FloatArrayF< 3 > &generalizedStrain, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not supported in given cross-section (yet)."); - return zeros< 3 >(); } void @@ -855,7 +847,6 @@ FloatMatrixF< 6, 6 > LayeredCrossSection::give3dBeamStiffMtrx(MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not implemented"); - return FloatMatrixF< 6, 6 >(); } @@ -873,7 +864,6 @@ FloatMatrixF< 3, 3 > LayeredCrossSection::give2dPlateSubSoilStiffMtrx(MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not implemented"); - return FloatMatrixF< 3, 3 >(); } @@ -917,7 +907,6 @@ LayeredCrossSection::giveFirstPKStress_3d(const FloatArrayF< 9 > &vF, GaussPoint } } else { OOFEM_ERROR("Only cubes and wedges are meaningful for layered cross-sections"); - return zeros< 9 >(); } } @@ -927,7 +916,6 @@ FloatArrayF< 5 > LayeredCrossSection::giveFirstPKStress_PlaneStrain(const FloatArrayF< 5 > &reducedvF, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not supported"); - return zeros< 5 >(); } @@ -935,7 +923,6 @@ FloatArrayF< 4 > LayeredCrossSection::giveFirstPKStress_PlaneStress(const FloatArrayF< 4 > &reducedvF, GaussPoint *masterGp, TimeStep *tStep) const { OOFEM_ERROR("Not supported"); - return zeros< 4 >(); //@todo: implement this for large strains //strain eps_x, eps_y, gamma_xy //stress sig_x, sig_y, tau_xy @@ -979,7 +966,6 @@ FloatArrayF< 1 > LayeredCrossSection::giveFirstPKStress_1d(const FloatArrayF< 1 > &strain, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not supported"); - return zeros< 1 >(); } @@ -1050,7 +1036,6 @@ FloatMatrixF< 4, 4 > LayeredCrossSection::giveStiffnessMatrix_dPdF_PlaneStress(MatResponseMode rMode, GaussPoint *masterGp, TimeStep *tStep) const { OOFEM_ERROR("Not supported"); - return FloatMatrixF< 4, 4 >(); /*@todo: implement for large strains * FloatMatrixF<3,3> answer; * double totThick = 0.; @@ -1077,7 +1062,6 @@ FloatMatrixF< 5, 5 > LayeredCrossSection::giveStiffnessMatrix_dPdF_PlaneStrain(MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not supported"); - return FloatMatrixF< 5, 5 >(); } @@ -1085,7 +1069,6 @@ FloatMatrixF< 1, 1 > LayeredCrossSection::giveStiffnessMatrix_dPdF_1d(MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("Not supported"); - return FloatMatrixF< 1, 1 >(); } @@ -1178,7 +1161,7 @@ LayeredCrossSection::initializeFrom(InputRecord &ir) if ( numberOfLayers != layerMaterials.giveSize() ) { if ( layerMaterials.giveSize() == 1 ) { OOFEM_WARNING("Assuming same material in all layers"); - double temp = layerMaterials.at(1); + int temp = layerMaterials.at(1); layerMaterials.resize(numberOfLayers); layerMaterials.zero(); layerMaterials.add(temp); @@ -1362,7 +1345,6 @@ LayeredCrossSection::setupIntegrationPoints(IntegrationRule &irule, int nPointsX default: OOFEM_ERROR( "Unknown mode (%d)", element->giveIntegrationDomain() ); } - return 0; } @@ -1532,7 +1514,7 @@ LayeredCrossSection::giveCorrespondingSlaveMaterialMode(MaterialMode masterMode) throw std::runtime_error("unsupported material mode"); } - return _Unknown; + //return _Unknown; } @@ -1640,12 +1622,12 @@ LayeredCrossSection::setupLayeredIntegrationRule(std::vector< std::unique_ptr< I { // Loop over each layer and set up an integration rule as if each layer was an independent element // @todo - only works for wedge integration at the moment - int numberOfLayers = this->giveNumberOfLayers(); + int nLayers = this->giveNumberOfLayers(); int numPointsThickness = this->giveNumIntegrationPointsInLayer(); integrationRulesArray.clear(); - integrationRulesArray.reserve(numberOfLayers); - for ( int i = 0; i < numberOfLayers; i++ ) { + integrationRulesArray.reserve(nLayers); + for ( int i = 0; i < nLayers; i++ ) { integrationRulesArray.emplace_back(new LayeredIntegrationRule(i + 1, el) ); integrationRulesArray.back()->SetUpPointsOnWedge(numInPlanePoints, numPointsThickness, _3dMat); } @@ -1671,7 +1653,7 @@ LayeredCrossSection::mapLayerGpCoordsToShellCoords(std::vector< std::unique_ptr< { double scaleFactor = 0.999; // Will be numerically unstable with xfem if the endpoints lie at +-1 double totalThickness = this->computeIntegralThick(); - int number = 1; + int indx = 1; for ( int layer = 1; layer <= numberOfLayers; layer++ ) { for ( GaussPoint *gp: * layerIntegrationRulesArray [ layer - 1 ] ) { // Map local layer cs to local shell cs @@ -1682,8 +1664,8 @@ LayeredCrossSection::mapLayerGpCoordsToShellCoords(std::vector< std::unique_ptr< FloatArray lcoords = gp->giveNaturalCoordinates(); lcoords.at(3) = xinew; gp->setNaturalCoordinates(lcoords); - gp->number = number; // fix gp ordering - number++; + gp->number = indx; // fix gp ordering + indx++; } } } diff --git a/src/sm/CrossSections/layeredcrosssection.h b/src/sm/CrossSections/layeredcrosssection.h index 1a2407d06..39fab90b7 100644 --- a/src/sm/CrossSections/layeredcrosssection.h +++ b/src/sm/CrossSections/layeredcrosssection.h @@ -236,19 +236,16 @@ class LayeredCrossSection : public StructuralCrossSection int packUnknowns(DataStream &buff, TimeStep *tStep, GaussPoint *ip) override { OOFEM_ERROR("not implemented"); - return 0; } int unpackAndUpdateUnknowns(DataStream &buff, TimeStep *tStep, GaussPoint *ip) override { OOFEM_ERROR("not implemented"); - return 0; } int estimatePackSize(DataStream &buff, GaussPoint *ip) override { OOFEM_ERROR("not implemented"); - return 0; } diff --git a/src/sm/CrossSections/structuralcrosssection.h b/src/sm/CrossSections/structuralcrosssection.h index 4e334396c..55d1dadda 100644 --- a/src/sm/CrossSections/structuralcrosssection.h +++ b/src/sm/CrossSections/structuralcrosssection.h @@ -353,7 +353,7 @@ class OOFEM_EXPORT StructuralCrossSection : public CrossSection int testCrossSectionExtension(CrossSectExtension ext) override { return ( ( ext == CS_StructuralCapability ) ? 1 : 0 ); } ///@todo This shouldn't be optional - Material *giveMaterial(IntegrationPoint *ip) const override { OOFEM_ERROR("Missing implementation"); return nullptr; } + Material *giveMaterial(IntegrationPoint *ip) const override { OOFEM_ERROR("Missing implementation"); } virtual Interface *giveMaterialInterface(InterfaceType t, IntegrationPoint *ip) { return nullptr; } virtual void createMaterialStatus(GaussPoint &iGP) = 0; diff --git a/src/sm/Elements/3D/lspace.h b/src/sm/Elements/3D/lspace.h index bff00e241..db84e5ce5 100644 --- a/src/sm/Elements/3D/lspace.h +++ b/src/sm/Elements/3D/lspace.h @@ -95,6 +95,8 @@ class LSpace : public Structural3DElement, public ZZNodalRecoveryModelInterface // definition & identification const char *giveInputRecordName() const override { return _IFT_LSpace_Name; } const char *giveClassName() const override { return "LSpace"; } + Element_Geometry_Type giveGeometryType() const override {return EGT_hexa_1;} + void initializeFrom(InputRecord &ir) override; #ifdef __OOFEG diff --git a/src/sm/Elements/3D/ltrspace.C b/src/sm/Elements/3D/ltrspace.C index fd04361ae..df9a15269 100644 --- a/src/sm/Elements/3D/ltrspace.C +++ b/src/sm/Elements/3D/ltrspace.C @@ -274,7 +274,7 @@ void LTRSpace :: drawRawGeometry(oofegGraphicContext &gc, TimeStep *tStep) EASValsSetEdgeFlag(true); EASValsSetLayer(OOFEG_RAW_GEOMETRY_LAYER); EASValsSetFillStyle(FILL_SOLID); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if (this->giveParallelMode() == Element_remote) { EASValsSetColor( gc.getRemoteElementColor() ); EASValsSetEdgeColor( gc.getRemoteElementEdgeColor() ); diff --git a/src/sm/Elements/3D/ltrspace.h b/src/sm/Elements/3D/ltrspace.h index a2aa30552..1e53384c1 100644 --- a/src/sm/Elements/3D/ltrspace.h +++ b/src/sm/Elements/3D/ltrspace.h @@ -76,6 +76,8 @@ public HuertaErrorEstimatorInterface // definition & identification const char *giveInputRecordName() const override { return _IFT_LTRSpace_Name; } const char *giveClassName() const override { return "LTRSpace"; } + Element_Geometry_Type giveGeometryType() const override {return EGT_tetra_1;} + #ifdef __OOFEG void drawRawGeometry(oofegGraphicContext &gc, TimeStep *tStep) override; diff --git a/src/sm/Elements/3D/ltrspaceboundary.h b/src/sm/Elements/3D/ltrspaceboundary.h index aa4579710..c8dfe054f 100644 --- a/src/sm/Elements/3D/ltrspaceboundary.h +++ b/src/sm/Elements/3D/ltrspaceboundary.h @@ -94,6 +94,8 @@ class LTRSpaceBoundary : public Structural3DElement, public NodalAveragingRecove void initializeFrom(InputRecord &ir) override; const char *giveInputRecordName() const override { return _IFT_LTRSpaceBoundary_Name; } const char *giveClassName() const override { return "LTRSpaceBoundary"; } + Element_Geometry_Type giveGeometryType() const override {return EGT_tetra_1;} + void NodalAveragingRecoveryMI_computeNodalValue(FloatArray &answer, int node, InternalStateType type, TimeStep *tStep) override; diff --git a/src/sm/Elements/3D/lwedge.h b/src/sm/Elements/3D/lwedge.h index 7de05ac8e..33eba208f 100644 --- a/src/sm/Elements/3D/lwedge.h +++ b/src/sm/Elements/3D/lwedge.h @@ -78,6 +78,8 @@ class LWedge : public Structural3DElement, public SPRNodalRecoveryModelInterface // definition & identification const char *giveInputRecordName() const override { return _IFT_LWedge_Name; } const char *giveClassName() const override { return "LWedge"; } + Element_Geometry_Type giveGeometryType() const override {return EGT_wedge_1;} + }; } // end namespace oofem #endif diff --git a/src/sm/Elements/3D/macrolspace.C b/src/sm/Elements/3D/macrolspace.C index 47f89cefd..c4026176d 100644 --- a/src/sm/Elements/3D/macrolspace.C +++ b/src/sm/Elements/3D/macrolspace.C @@ -278,8 +278,8 @@ void MacroLSpace :: evalInterpolation(FloatArray &answer, const std::vector< Flo //this->interpolation.global2local(localCoords, coords, gcoords, 0.0);//returns even outside the element boundaries //this->interpolation.evalN(answer, localCoords, 0.0); - this->interpolation.global2local( localCoords, gcoords, FEIVertexListGeometryWrapper(coords) ); //returns even outside the element boundaries - this->interpolation.evalN( answer, localCoords, FEIVertexListGeometryWrapper(coords) ); + this->interpolation.global2local( localCoords, gcoords, FEIVertexListGeometryWrapper(coords, this->interpolation.giveGeometryType()) ); //returns even outside the element boundaries + this->interpolation.evalN( answer, localCoords, FEIVertexListGeometryWrapper(coords, this->interpolation.giveGeometryType()) ); } diff --git a/src/sm/Elements/3D/q27space.h b/src/sm/Elements/3D/q27space.h index d6e52eebc..8a11394ee 100644 --- a/src/sm/Elements/3D/q27space.h +++ b/src/sm/Elements/3D/q27space.h @@ -75,6 +75,8 @@ class Q27Space : public Structural3DElement, public SPRNodalRecoveryModelInterfa // definition & identification const char *giveInputRecordName() const override { return _IFT_Q27Space_Name; } const char *giveClassName() const override { return "Q27Space"; } + Element_Geometry_Type giveGeometryType() const override {return EGT_hexa_27;} + protected: int giveNumberOfIPForMassMtrxIntegration() override { return 27; } diff --git a/src/sm/Elements/3D/qspace.h b/src/sm/Elements/3D/qspace.h index 5949c85f8..4a28bde81 100644 --- a/src/sm/Elements/3D/qspace.h +++ b/src/sm/Elements/3D/qspace.h @@ -81,6 +81,8 @@ class QSpace : public Structural3DElement, public SPRNodalRecoveryModelInterface // definition & identification const char *giveInputRecordName() const override { return _IFT_QSpace_Name; } const char *giveClassName() const override { return "QSpace"; } + Element_Geometry_Type giveGeometryType() const override {return EGT_hexa_2;} + protected: int giveNumberOfIPForMassMtrxIntegration() override { return 27; } diff --git a/src/sm/Elements/3D/qtrspace.h b/src/sm/Elements/3D/qtrspace.h index 1a598c692..c88378ffb 100644 --- a/src/sm/Elements/3D/qtrspace.h +++ b/src/sm/Elements/3D/qtrspace.h @@ -84,6 +84,8 @@ class QTRSpace : public Structural3DElement, public SPRNodalRecoveryModelInterfa // definition & identification const char *giveInputRecordName() const override { return _IFT_QTRSpace_Name; } const char *giveClassName() const override { return "QTRSpace"; } + Element_Geometry_Type giveGeometryType() const override {return EGT_tetra_2;} + }; } // end namespace oofem #endif diff --git a/src/sm/Elements/3D/qwedge.h b/src/sm/Elements/3D/qwedge.h index f70412eff..bf4b375b4 100644 --- a/src/sm/Elements/3D/qwedge.h +++ b/src/sm/Elements/3D/qwedge.h @@ -80,6 +80,8 @@ class QWedge : public Structural3DElement, public SPRNodalRecoveryModelInterface // definition & identification const char *giveInputRecordName() const override { return _IFT_QWedge_Name; } const char *giveClassName() const override { return "QWedge"; } + Element_Geometry_Type giveGeometryType() const override {return EGT_wedge_2;} + }; } // end namespace oofem #endif diff --git a/src/sm/Elements/AbaqusUserElement.h b/src/sm/Elements/AbaqusUserElement.h index 7b09f919d..7433327cf 100644 --- a/src/sm/Elements/AbaqusUserElement.h +++ b/src/sm/Elements/AbaqusUserElement.h @@ -222,7 +222,6 @@ class AbaqusUserElement : public StructuralElement int giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type, TimeStep *tStep) override { OOFEM_ERROR("Function not defined for AbaqusUserElement and should never be called. This is a bug."); - return 0; } }; }// namespace oofem diff --git a/src/sm/Elements/Axisymmetry/axisymm3d.h b/src/sm/Elements/Axisymmetry/axisymm3d.h index e8143fe88..fbe2efa7e 100644 --- a/src/sm/Elements/Axisymmetry/axisymm3d.h +++ b/src/sm/Elements/Axisymmetry/axisymm3d.h @@ -90,6 +90,8 @@ public SpatialLocalizerInterface const char *giveClassName() const override { return "Axisymm3d"; } const char *giveInputRecordName() const override { return _IFT_Axisymm3d_Name; } + Element_Geometry_Type giveGeometryType() const override {return EGT_triangle_1;} + void initializeFrom(InputRecord &ir) override; }; } // end namespace oofem diff --git a/src/sm/Elements/Axisymmetry/l4axisymm.h b/src/sm/Elements/Axisymmetry/l4axisymm.h index 4186eee2b..f99556422 100644 --- a/src/sm/Elements/Axisymmetry/l4axisymm.h +++ b/src/sm/Elements/Axisymmetry/l4axisymm.h @@ -67,6 +67,7 @@ public SpatialLocalizerInterface // definition & identification const char *giveInputRecordName() const override { return _IFT_L4Axisymm_Name; } const char *giveClassName() const override { return "L4Axisymm"; } + Element_Geometry_Type giveGeometryType() const override {return EGT_quad_1;} void initializeFrom(InputRecord &ir) override; diff --git a/src/sm/Elements/Axisymmetry/q4axisymm.h b/src/sm/Elements/Axisymmetry/q4axisymm.h index ce582ec2c..8094b230a 100644 --- a/src/sm/Elements/Axisymmetry/q4axisymm.h +++ b/src/sm/Elements/Axisymmetry/q4axisymm.h @@ -69,6 +69,8 @@ class Q4Axisymm : public AxisymElement, public ZZNodalRecoveryModelInterface Interface *giveInterface(InterfaceType) override; const char *giveInputRecordName() const override { return _IFT_Q4Axisymm_Name; } const char *giveClassName() const override { return "Q4axisymm"; } + Element_Geometry_Type giveGeometryType() const override {return EGT_quad_2;} + void initializeFrom(InputRecord &ir) override; void computeBmatrixAt(GaussPoint *gp, FloatMatrix &answer, int lowerIndx = 1, int upperIndx = ALL_STRAINS) override; diff --git a/src/sm/Elements/Bars/qtruss1d.h b/src/sm/Elements/Bars/qtruss1d.h index 1b43750d6..6828e6f32 100644 --- a/src/sm/Elements/Bars/qtruss1d.h +++ b/src/sm/Elements/Bars/qtruss1d.h @@ -74,6 +74,8 @@ class QTruss1d : public NLStructuralElement // definition & identification const char *giveInputRecordName() const override { return _IFT_QTruss1d_Name; } const char *giveClassName() const override { return "QTruss1d"; } + Element_Geometry_Type giveGeometryType() const override {return EGT_line_2;} + MaterialMode giveMaterialMode() override { return _1dMat; } int computeGlobalCoordinates(FloatArray &answer, const FloatArray &lcoords) override; diff --git a/src/sm/Elements/Bars/truss1d.h b/src/sm/Elements/Bars/truss1d.h index f0e8723cf..1493c83e9 100644 --- a/src/sm/Elements/Bars/truss1d.h +++ b/src/sm/Elements/Bars/truss1d.h @@ -98,6 +98,8 @@ class Truss1d : public NLStructuralElement, const char *giveInputRecordName() const override { return _IFT_Truss1d_Name; } const char *giveClassName() const override { return "Truss1d"; } MaterialMode giveMaterialMode() override { return _1dMat; } + Element_Geometry_Type giveGeometryType() const override {return EGT_line_1;} + // NodalAveragingRecoveryMInterface void NodalAveragingRecoveryMI_computeNodalValue(FloatArray &answer, int node, diff --git a/src/sm/Elements/Bars/truss3d.h b/src/sm/Elements/Bars/truss3d.h index 5506c8634..48ccd7f05 100644 --- a/src/sm/Elements/Bars/truss3d.h +++ b/src/sm/Elements/Bars/truss3d.h @@ -96,6 +96,8 @@ class Truss3d : public NLStructuralElement, const char *giveClassName() const override { return "Truss3d"; } void initializeFrom(InputRecord &ir) override; MaterialMode giveMaterialMode() override { return _1dMat; } + Element_Geometry_Type giveGeometryType() const override {return EGT_line_1;} + void computeStressVector(FloatArray &answer, const FloatArray &strain, GaussPoint *gp, TimeStep *tStep) override; void computeConstitutiveMatrixAt(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) override; void computeConstitutiveMatrix_dPdF_At(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) override; diff --git a/src/sm/Elements/Bars/truss3dnl.C b/src/sm/Elements/Bars/truss3dnl.C index fc3c7f4a2..a6b71593b 100644 --- a/src/sm/Elements/Bars/truss3dnl.C +++ b/src/sm/Elements/Bars/truss3dnl.C @@ -82,8 +82,8 @@ Truss3dnl :: giveInternalForcesVector(FloatArray &answer, TimeStep *tStep, int u for ( auto &gp: *this->giveDefaultIntegrationRulePtr() ) { StructuralMaterialStatus *matStat = static_cast< StructuralMaterialStatus * >( gp->giveMaterialStatus() ); - this->computeBmatrixAt(gp, B, tStep, true); - this->computeBmatrixAt(gp, Be, tStep); + this->_computeBmatrixAt(gp, B, tStep, true); + this->_computeBmatrixAt(gp, Be, tStep); if ( useUpdatedGpRecord == 1 ) { vStress = matStat->giveStressVector(); } else { @@ -152,7 +152,7 @@ Truss3dnl :: computeStiffnessMatrix(FloatMatrix &answer, if ( integrationRulesArray.size() == 1 ) { FloatMatrix B, D, DB, Ksigma; for ( auto &gp : *this->giveDefaultIntegrationRulePtr() ) { - this->computeBmatrixAt(gp, B, tStep, true); + this->_computeBmatrixAt(gp, B, tStep, true); this->computeConstitutiveMatrixAt(D, rMode, gp, tStep); double dV = this->computeVolumeAround(gp); DB.beProductOf(D, B); @@ -175,7 +175,7 @@ Truss3dnl :: computeStiffnessMatrix(FloatMatrix &answer, void -Truss3dnl :: computeBmatrixAt(GaussPoint *gp, FloatMatrix &answer, TimeStep *tStep, bool lin) +Truss3dnl :: _computeBmatrixAt(GaussPoint *gp, FloatMatrix &answer, TimeStep *tStep, bool lin) { FloatMatrix Bl, Bnl; this->computeBlMatrixAt(gp, Bl); @@ -233,7 +233,7 @@ Truss3dnl :: computeInitialStressStiffness(FloatMatrix &answer, MatResponseMode FloatArray d, strain; FloatMatrix B; this->computeVectorOf(VM_Total, tStep, d); - this->computeBmatrixAt(gp, B, tStep); + this->_computeBmatrixAt(gp, B, tStep); strain.beProductOf(B, d); // add influence of initial stress/stretch double l2 = initialStretch*initialStretch; diff --git a/src/sm/Elements/Bars/truss3dnl.h b/src/sm/Elements/Bars/truss3dnl.h index c6b80f4fe..73d7feb7f 100644 --- a/src/sm/Elements/Bars/truss3dnl.h +++ b/src/sm/Elements/Bars/truss3dnl.h @@ -66,7 +66,7 @@ class Truss3dnl : public Truss3d protected: - void computeBmatrixAt(GaussPoint *gp, FloatMatrix &answer, TimeStep *tStep, bool lin = false); + void _computeBmatrixAt(GaussPoint *gp, FloatMatrix &answer, TimeStep *tStep, bool lin = false); void computeBlMatrixAt(GaussPoint *gp, FloatMatrix &answer); void computeBnlMatrixAt(GaussPoint *gp, FloatMatrix &answer, TimeStep *tStep, bool lin = false); void computeInitialStressStiffness(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep); diff --git a/src/sm/Elements/Bars/truss3dnl2.C b/src/sm/Elements/Bars/truss3dnl2.C index 61ab2e0f1..17c5bd8f8 100644 --- a/src/sm/Elements/Bars/truss3dnl2.C +++ b/src/sm/Elements/Bars/truss3dnl2.C @@ -83,7 +83,7 @@ Truss3dnl2 :: giveInternalForcesVector(FloatArray &answer, TimeStep *tStep, int answer.clear(); for ( auto &gp: *this->giveDefaultIntegrationRulePtr() ) { StructuralMaterialStatus *matStat = static_cast< StructuralMaterialStatus * >( gp->giveMaterialStatus() ); - this->computeBmatrixAt(gp, B, tStep, u); + this->_computeBmatrixAt(gp, B, tStep, u); if ( useUpdatedGpRecord == 1 ) { vStress = matStat->givePVector(); } else { @@ -93,7 +93,7 @@ Truss3dnl2 :: giveInternalForcesVector(FloatArray &answer, TimeStep *tStep, int vStrain.zero(); } // compute strain tensor, i.e., Biot strain - auto vStrain = this->computeStrainVector(gp, u); + auto vStrain = this->_computeStrainVector(gp, u); // compute stress tensor, i.e., firt Piola-Kirchhoff vStress = this->giveStructuralCrossSection()->giveFirstPKStresses(vStrain, gp, tStep); } @@ -150,7 +150,7 @@ Truss3dnl2 :: computeDeformedLength(const FloatArray &d) FloatArray -Truss3dnl2 :: computeStrainVector(GaussPoint *gp, const FloatArray &d) +Truss3dnl2 :: _computeStrainVector(GaussPoint *gp, const FloatArray &d) { FloatArray answer(1); auto l = this->computeDeformedLength(d); @@ -178,7 +178,7 @@ Truss3dnl2 :: computeStiffnessMatrix(FloatMatrix &answer, if ( integrationRulesArray.size() == 1 ) { FloatMatrix B, D, DB, Ksigma; for ( auto &gp : *this->giveDefaultIntegrationRulePtr() ) { - this->computeBmatrixAt(gp, B, tStep, u); + this->_computeBmatrixAt(gp, B, tStep, u); this->computeConstitutiveMatrixAt(D, rMode, gp, tStep); double dV = this->computeVolumeAround(gp); DB.beProductOf(D, B); @@ -209,7 +209,7 @@ Truss3dnl2 :: computeConstitutiveMatrixAt(FloatMatrix &answer, MatResponseMode r void -Truss3dnl2 :: computeBmatrixAt(GaussPoint *gp, FloatMatrix &answer, TimeStep *tStep, const FloatArray &d) +Truss3dnl2 :: _computeBmatrixAt(GaussPoint *gp, FloatMatrix &answer, TimeStep *tStep, const FloatArray &d) { double L = computeLength(); double l = computeDeformedLength(d); @@ -261,7 +261,7 @@ Truss3dnl2 :: computeInitialStressStiffness(FloatMatrix &answer, MatResponseMode answer = A; answer.subtract(AxxA); answer.times(1./l/L); - auto stress = this->giveStructuralCrossSection()->giveFirstPKStresses(this->computeStrainVector(gp, d), gp, tStep); + auto stress = this->giveStructuralCrossSection()->giveFirstPKStresses(this->_computeStrainVector(gp, d), gp, tStep); // prevent zero initial stress stiffness if ( stress.at(1) == 0 ) { diff --git a/src/sm/Elements/Bars/truss3dnl2.h b/src/sm/Elements/Bars/truss3dnl2.h index ef9b5f9d1..be871cad1 100644 --- a/src/sm/Elements/Bars/truss3dnl2.h +++ b/src/sm/Elements/Bars/truss3dnl2.h @@ -74,8 +74,8 @@ class Truss3dnl2 : public Truss3d protected: - FloatArray computeStrainVector(GaussPoint *gp, const FloatArray &u); - void computeBmatrixAt(GaussPoint *gp, FloatMatrix &answer, TimeStep *tStep, const FloatArray &u); + FloatArray _computeStrainVector(GaussPoint *gp, const FloatArray &u); + void _computeBmatrixAt(GaussPoint *gp, FloatMatrix &answer, TimeStep *tStep, const FloatArray &u); void computeInitialStressStiffness(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep, const FloatMatrix &B, const FloatArray &d); std::pair computeDeformedLengthAt(GaussPoint *gp, const FloatArray &d); diff --git a/src/sm/Elements/Beams/beam2d.C b/src/sm/Elements/Beams/beam2d.C index 550044cd6..fba243ff3 100644 --- a/src/sm/Elements/Beams/beam2d.C +++ b/src/sm/Elements/Beams/beam2d.C @@ -74,6 +74,7 @@ Beam2d :: Beam2d(int n, Domain *aDomain) : BeamBaseElement(n, aDomain), LayeredC ghostNodes [ 0 ] = ghostNodes [ 1 ] = NULL; numberOfCondensedDofs = 0; + cs_mode = 0; } @@ -231,9 +232,20 @@ Beam2d :: computeGtoLRotationMatrix(FloatMatrix &answer) if ( this->hasDofs2Condense() ) { int condensedDofCounter = 0; - DofIDItem dofids[] = { - D_u, D_w, R_v - }; + DofIDItem dofids[3]; + if ( cs_mode == 0 ) { + dofids[0] = D_u; + dofids[1] = D_w; + dofids[2] = R_v; + //{ + // D_u, D_w, R_v + // //D_u, D_v, R_v + //}; + } else { + dofids[0] = D_u; + dofids[1] = D_v; + dofids[2] = R_v; + } FloatMatrix l2p(6, ndofs); // local -> primary l2p.zero(); // loop over nodes @@ -278,7 +290,8 @@ Beam2d :: computeStrainVectorInLayer(FloatArray &answer, const FloatArray &maste top = this->giveCrossSection()->give(CS_TopZCoord, masterGp); bottom = this->giveCrossSection()->give(CS_BottomZCoord, masterGp); - layerZeta = slaveGp->giveNaturalCoordinate(3); + //layerZeta = slaveGp->giveNaturalCoordinate(3); + layerZeta = slaveGp->giveNaturalCoordinate( 2 ); layerZCoord = 0.5 * ( ( 1. - layerZeta ) * bottom + ( 1. + layerZeta ) * top ); answer.resize(2); // {Exx,GMzx} @@ -291,9 +304,11 @@ Beam2d :: computeStrainVectorInLayer(FloatArray &answer, const FloatArray &maste void Beam2d :: giveDofManDofIDMask(int inode, IntArray &answer) const { - answer = { - D_u, D_w, R_v - }; + if ( cs_mode == 0 ) { + answer = { D_u, D_w, R_v }; + } else { + answer = { D_u, D_v, R_v }; + } } @@ -302,12 +317,17 @@ Beam2d :: computeLength() { double dx, dy; Node *nodeA, *nodeB; - + if ( length == 0. ) { nodeA = this->giveNode(1); nodeB = this->giveNode(2); dx = nodeB->giveCoordinate(1) - nodeA->giveCoordinate(1); - dy = nodeB->giveCoordinate(3) - nodeA->giveCoordinate(3); + if ( cs_mode == 0 ) { + dy = nodeB->giveCoordinate( 3 ) - nodeA->giveCoordinate( 3 ); + } else { + // dy = nodeB->giveCoordinate(3) - nodeA->giveCoordinate(3); + dy = nodeB->giveCoordinate( 2 ) - nodeA->giveCoordinate( 2 ); + } length = sqrt(dx * dx + dy * dy); } @@ -326,8 +346,13 @@ Beam2d :: givePitch() nodeB = this->giveNode(2); xA = nodeA->giveCoordinate(1); xB = nodeB->giveCoordinate(1); - yA = nodeA->giveCoordinate(3); - yB = nodeB->giveCoordinate(3); + if ( cs_mode == 0 ) { + yA = nodeA->giveCoordinate(3); + yB = nodeB->giveCoordinate(3); + } else { + yA = nodeA->giveCoordinate( 2 ); + yB = nodeB->giveCoordinate( 2 ); + } pitch = atan2(yB - yA, xB - xA); } @@ -382,6 +407,8 @@ Beam2d :: initializeFrom(InputRecord &ir) { // first call parent BeamBaseElement :: initializeFrom(ir); + cs_mode = 0; + IR_GIVE_OPTIONAL_FIELD( ir, cs_mode, _IFT_Beam2d_cs ); if ( ir.hasField(_IFT_Beam2d_dofstocondense) ) { IntArray val; @@ -389,10 +416,19 @@ Beam2d :: initializeFrom(InputRecord &ir) if ( val.giveSize() >= 6 ) { throw ValueInputException(ir, _IFT_Beam2d_dofstocondense, "wrong input data for condensed dofs"); } - - DofIDItem mask[] = { - D_u, D_w, R_v - }; + DofIDItem mask[3]; + if ( cs_mode == 0 ) { + mask[0] = D_u; + mask[1] = D_w; + mask[2] = R_v; + //D_u, D_v, R_v + } else { + mask[0] = D_u; + mask[1] = D_v; + mask[2] = R_v; + //D_u, D_v, R_v + } + this->numberOfCondensedDofs = val.giveSize(); for ( int i = 1; i <= val.giveSize(); i++ ) { if ( val.at(i) <= 3 ) { @@ -457,10 +493,23 @@ Beam2d :: computeBoundaryEdgeLoadVector(FloatArray &answer, BoundaryLoad *load, const FloatArray &lcoords = gp->giveNaturalCoordinates(); this->computeNmatrixAt(lcoords, N); if ( load->giveFormulationType() == Load :: FT_Entity ) { - load->computeValues(t, tStep, lcoords, { D_u, D_w, R_v }, mode); + if ( cs_mode == 0 ) { + load->computeValues(t, tStep, lcoords, { D_u, D_w, R_v }, mode); + //load->computeValues( t, tStep, lcoords, { D_u, D_v, R_v }, mode ); + } else { + // load->computeValues(t, tStep, lcoords, { D_u, D_w, R_v }, mode); + load->computeValues( t, tStep, lcoords, { D_u, D_v, R_v }, mode ); + } + } else { - this->computeGlobalCoordinates(coords, lcoords); - load->computeValues(t, tStep, coords, { D_u, D_w, R_v }, mode); + this->computeGlobalCoordinates( coords, lcoords ); + if ( cs_mode == 0 ) { + load->computeValues(t, tStep, coords, { D_u, D_w, R_v }, mode); + //load->computeValues( t, tStep, coords, { D_u, D_v, R_v }, mode ); + } else{ + // load->computeValues(t, tStep, coords, { D_u, D_w, R_v }, mode); + load->computeValues( t, tStep, coords, { D_u, D_v, R_v }, mode ); + } } if ( load->giveCoordSystMode() == Load :: CST_Global ) { diff --git a/src/sm/Elements/Beams/beam2d.h b/src/sm/Elements/Beams/beam2d.h index df7252f85..ab8e28aff 100644 --- a/src/sm/Elements/Beams/beam2d.h +++ b/src/sm/Elements/Beams/beam2d.h @@ -43,6 +43,7 @@ //@{ #define _IFT_Beam2d_Name "beam2d" #define _IFT_Beam2d_dofstocondense "dofstocondense" +#define _IFT_Beam2d_cs "cs" //@} namespace oofem { @@ -72,7 +73,7 @@ class Beam2d : public BeamBaseElement, public LayeredCrossSectionInterface DofManager *ghostNodes [ 2 ]; /// number of condensed DOFs int numberOfCondensedDofs; - + int cs_mode; static FEI2dLineLin interp_geom; static FEI2dLineHermite interp_beam; @@ -107,7 +108,6 @@ class Beam2d : public BeamBaseElement, public LayeredCrossSectionInterface return ghostNodes [ 1 ]; } else { OOFEM_ERROR("No such DOF available on Element %d", number); - return NULL; } } void giveInternalDofManDofIDMask(int i, IntArray &answer) const override { @@ -135,6 +135,8 @@ class Beam2d : public BeamBaseElement, public LayeredCrossSectionInterface double computeVolumeAround(GaussPoint *gp) override; void printOutputAt(FILE *file, TimeStep *tStep) override; + Element_Geometry_Type giveGeometryType() const override {return EGT_line_1;} + const char *giveClassName() const override { return "Beam2d"; } const char *giveInputRecordName() const override { return _IFT_Beam2d_Name; } void initializeFrom(InputRecord &ir) override; diff --git a/src/sm/Elements/Beams/beam3d.h b/src/sm/Elements/Beams/beam3d.h index fa06850d8..8ebb69da0 100644 --- a/src/sm/Elements/Beams/beam3d.h +++ b/src/sm/Elements/Beams/beam3d.h @@ -129,7 +129,6 @@ class FEI3dLineLin; return ghostNodes [ 1 ]; } else { OOFEM_ERROR("No such DOF available on Element %d", number); - return nullptr; } } void giveInternalDofManDofIDMask(int i, IntArray &answer) const override { diff --git a/src/sm/Elements/Beams/libeam2d.h b/src/sm/Elements/Beams/libeam2d.h index f1034b800..3709b2acd 100644 --- a/src/sm/Elements/Beams/libeam2d.h +++ b/src/sm/Elements/Beams/libeam2d.h @@ -84,6 +84,8 @@ class LIBeam2d : public StructuralElement, public LayeredCrossSectionInterface int computeNumberOfDofs() override { return 6; } void giveDofManDofIDMask(int inode, IntArray &) const override; double computeVolumeAround(GaussPoint *gp) override; + Element_Geometry_Type giveGeometryType() const override {return EGT_line_1;} + // definition & identification const char *giveInputRecordName() const override { return _IFT_LIBeam2d_Name; } diff --git a/src/sm/Elements/Beams/libeam3d.C b/src/sm/Elements/Beams/libeam3d.C index 8026e8a02..30b568be8 100644 --- a/src/sm/Elements/Beams/libeam3d.C +++ b/src/sm/Elements/Beams/libeam3d.C @@ -398,7 +398,6 @@ Node* LIBeam3d :: giveReferenceNode(int refNode) } OOFEM_ERROR("Could not find the reference node. Check numbering."); - return nullptr; } int diff --git a/src/sm/Elements/GradientDamage/PlaneStrain/qtrplanestraingraddamage.C b/src/sm/Elements/GradientDamage/PlaneStrain/qtrplanestraingraddamage.C index 3bcf61d49..a5f0bdc5c 100644 --- a/src/sm/Elements/GradientDamage/PlaneStrain/qtrplanestraingraddamage.C +++ b/src/sm/Elements/GradientDamage/PlaneStrain/qtrplanestraingraddamage.C @@ -113,11 +113,11 @@ QTrPlaneStrainGradDamage :: computeGaussPoints() } void -QTrPlaneStrainGradDamage :: computeNdMatrixAt(GaussPoint *gp, FloatMatrix &answer) +QTrPlaneStrainGradDamage :: computeNdMatrixAt(GaussPoint *gp, FloatArray &answer) { - FloatArray n; - this->interpolation_lin.evalN( n, gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(this) ); - answer.beNMatrixOf(n, 1); + //FloatArray n; + this->interpolation_lin.evalN( answer, gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(this) ); + //answer.beNMatrixOf(n, 1); } void diff --git a/src/sm/Elements/GradientDamage/PlaneStrain/qtrplanestraingraddamage.h b/src/sm/Elements/GradientDamage/PlaneStrain/qtrplanestraingraddamage.h index f8a0f9c86..dcc89753e 100644 --- a/src/sm/Elements/GradientDamage/PlaneStrain/qtrplanestraingraddamage.h +++ b/src/sm/Elements/GradientDamage/PlaneStrain/qtrplanestraingraddamage.h @@ -57,7 +57,7 @@ class QTrPlaneStrainGradDamage : public QTrPlaneStrain, public GradientDamageEle protected: void computeBdMatrixAt(GaussPoint *gp, FloatMatrix &answer) override; - void computeNdMatrixAt(GaussPoint *gp, FloatMatrix &answer); + void computeNdMatrixAt(GaussPoint *gp, FloatArray &answer) override; void computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, TimeStep *tStep) override { GradientDamageElement :: computeStiffnessMatrix(answer, rMode, tStep); } void giveInternalForcesVector(FloatArray &answer, TimeStep *tStep, int useUpdatedGpRecord = 0) override { GradientDamageElement :: giveInternalForcesVector(answer, tStep, useUpdatedGpRecord); } diff --git a/src/sm/Elements/Interfaces/Deprecated/interfaceelem2dlin.h b/src/sm/Elements/Interfaces/Deprecated/interfaceelem2dlin.h index 06495df4a..f6db2eab8 100644 --- a/src/sm/Elements/Interfaces/Deprecated/interfaceelem2dlin.h +++ b/src/sm/Elements/Interfaces/Deprecated/interfaceelem2dlin.h @@ -62,6 +62,8 @@ class InterfaceElem2dLin : public StructuralElement int computeNumberOfDofs() override { return 8; } void giveDofManDofIDMask(int inode, IntArray &answer) const override; + Element_Geometry_Type giveGeometryType() const override {return EGT_line_1;} + double computeVolumeAround(GaussPoint *gp) override; diff --git a/src/sm/Elements/Interfaces/Deprecated/interfaceelem2dquad.h b/src/sm/Elements/Interfaces/Deprecated/interfaceelem2dquad.h index eb7a52b28..c11531003 100644 --- a/src/sm/Elements/Interfaces/Deprecated/interfaceelem2dquad.h +++ b/src/sm/Elements/Interfaces/Deprecated/interfaceelem2dquad.h @@ -71,6 +71,8 @@ class InterfaceElem2dQuad : public StructuralElement int testElementExtension(ElementExtension ext) override { return 0; } Interface *giveInterface(InterfaceType) override { return NULL; } + Element_Geometry_Type giveGeometryType() const override {return EGT_line_2;} + #ifdef __OOFEG void drawRawGeometry(oofegGraphicContext &gc, TimeStep *tStep) override; diff --git a/src/sm/Elements/Interfaces/Deprecated/interfaceelem3dtrlin.C b/src/sm/Elements/Interfaces/Deprecated/interfaceelem3dtrlin.C index fba209d4a..ec5a7c795 100644 --- a/src/sm/Elements/Interfaces/Deprecated/interfaceelem3dtrlin.C +++ b/src/sm/Elements/Interfaces/Deprecated/interfaceelem3dtrlin.C @@ -125,7 +125,7 @@ bool InterfaceElement3dTrLin :: computeLocalCoordinates(FloatArray &answer, const FloatArray &gcoords) { OOFEM_ERROR("Not implemented"); - return false; + //return false; } @@ -143,7 +143,7 @@ InterfaceElement3dTrLin :: computeVolumeAround(GaussPoint *gp) lncp[ i - 1 ].beProductOf(lcs, this->giveNode(i)->giveCoordinates()); } - determinant = fabs( this->interpolation.giveTransformationJacobian( gp->giveNaturalCoordinates(), FEIVertexListGeometryWrapper(lncp) ) ); + determinant = fabs( this->interpolation.giveTransformationJacobian( gp->giveNaturalCoordinates(), FEIVertexListGeometryWrapper(lncp, this->giveGeometryType()) ) ); weight = gp->giveWeight(); thickness = this->giveCrossSection()->give(CS_Thickness, gp); volume = determinant * weight * thickness; diff --git a/src/sm/Elements/Interfaces/Deprecated/interfaceelement1d.C b/src/sm/Elements/Interfaces/Deprecated/interfaceelement1d.C index 01a563350..ed20f9144 100644 --- a/src/sm/Elements/Interfaces/Deprecated/interfaceelement1d.C +++ b/src/sm/Elements/Interfaces/Deprecated/interfaceelement1d.C @@ -121,7 +121,7 @@ InterfaceElem1d :: giveMaterialMode() default: OOFEM_ERROR("Unsupported coord mode"); } - return _1dInterface; // to make the compiler happy + //return _1dInterface; // to make the compiler happy } @@ -261,7 +261,7 @@ bool InterfaceElem1d :: computeLocalCoordinates(FloatArray &answer, const FloatArray &gcoords) { OOFEM_ERROR("Not implemented"); - return false; + //return false; } double @@ -323,7 +323,7 @@ InterfaceElem1d :: computeNumberOfDofs() OOFEM_ERROR("unsupported mode"); } - return 0; // to suppress compiler warning + //return 0; // to suppress compiler warning } diff --git a/src/sm/Elements/Interfaces/cohsur3d.C b/src/sm/Elements/Interfaces/cohsur3d.C index 8e74b5482..111ef3fca 100644 --- a/src/sm/Elements/Interfaces/cohsur3d.C +++ b/src/sm/Elements/Interfaces/cohsur3d.C @@ -406,7 +406,7 @@ CohesiveSurface3d :: initializeFrom(InputRecord &ir) if ( length <= 0. ) { throw ValueInputException(ir, _IFT_Element_nodes, "negative length evaluated"); // evaluate the coordinates of the center - evaluateCenter(); /// @todo This will never execute. Verify this / Mikael + //evaluateCenter(); /// @todo This will never execute. Verify this / Mikael } // evaluate the local coordinate system diff --git a/src/sm/Elements/Interfaces/cohsur3d.h b/src/sm/Elements/Interfaces/cohsur3d.h index 072ab3be0..1e724f746 100644 --- a/src/sm/Elements/Interfaces/cohsur3d.h +++ b/src/sm/Elements/Interfaces/cohsur3d.h @@ -81,6 +81,8 @@ class CohesiveSurface3d : public StructuralElement // definition & identification const char *giveClassName() const override { return "CohesiveSurface3d"; } const char *giveInputRecordName() const override { return _IFT_CohesiveSurface3d_Name; } + Element_Geometry_Type giveGeometryType() const override {return EGT_unknown;} + // input and output void initializeFrom(InputRecord &ir) override; diff --git a/src/sm/Elements/Interfaces/intelpoint.C b/src/sm/Elements/Interfaces/intelpoint.C index 5a20d6c07..521008971 100644 --- a/src/sm/Elements/Interfaces/intelpoint.C +++ b/src/sm/Elements/Interfaces/intelpoint.C @@ -92,7 +92,7 @@ IntElPoint :: giveMaterialMode() default: OOFEM_ERROR("Unsupported coord mode"); } - return _1dInterface; // to make the compiler happy + //return _1dInterface; // to make the compiler happy } @@ -277,7 +277,7 @@ IntElPoint :: computeNumberOfDofs() OOFEM_ERROR("Unsupported mode"); } - return 0; // to suppress compiler warning + //return 0; // to suppress compiler warning } diff --git a/src/sm/Elements/Interfaces/intelsurfquad1.C b/src/sm/Elements/Interfaces/intelsurfquad1.C index e5ad638f1..d54bec7e9 100644 --- a/src/sm/Elements/Interfaces/intelsurfquad1.C +++ b/src/sm/Elements/Interfaces/intelsurfquad1.C @@ -196,7 +196,7 @@ bool IntElSurfQuad1 :: computeLocalCoordinates(FloatArray &answer, const FloatArray &gcoords) { OOFEM_ERROR("Not implemented"); - return false; + //return false; } ///@todo this code not tested, onlu copied from interfaceelem3dtrlin.C //JB diff --git a/src/sm/Elements/Interfaces/intelsurftr1.C b/src/sm/Elements/Interfaces/intelsurftr1.C index 0bf692cd8..2e51da641 100644 --- a/src/sm/Elements/Interfaces/intelsurftr1.C +++ b/src/sm/Elements/Interfaces/intelsurftr1.C @@ -193,7 +193,7 @@ bool IntElSurfTr1 :: computeLocalCoordinates(FloatArray &answer, const FloatArray &gcoords) { OOFEM_ERROR("Not implemented"); - return false; + //return false; } ///@todo this code not tested, onlu copied from interfaceelem3dtrlin.C //JB diff --git a/src/sm/Elements/LatticeElements/latticebeam3d.h b/src/sm/Elements/LatticeElements/latticebeam3d.h index bd3ccc078..7a7e68d14 100644 --- a/src/sm/Elements/LatticeElements/latticebeam3d.h +++ b/src/sm/Elements/LatticeElements/latticebeam3d.h @@ -114,7 +114,7 @@ class LatticeBeam3d : public LatticeStructuralElement void computePropertiesOfCrossSection(); virtual void computeGaussPoints() override; - virtual integrationDomain giveIntegrationDomain() { return _Line; } + virtual integrationDomain giveIntegrationDomain() const override{ return _Line; } }; } // end namespace oofem #endif diff --git a/src/sm/Elements/PlaneStrain/qplanestrain.h b/src/sm/Elements/PlaneStrain/qplanestrain.h index 88a6708b6..833f03eed 100644 --- a/src/sm/Elements/PlaneStrain/qplanestrain.h +++ b/src/sm/Elements/PlaneStrain/qplanestrain.h @@ -61,6 +61,8 @@ class QPlaneStrain : public PlaneStrainElement, public ZZNodalRecoveryModelInter // definition & identification const char *giveInputRecordName() const override { return _IFT_QPlaneStrain_Name; } const char *giveClassName() const override { return "QPlaneStrain"; } + Element_Geometry_Type giveGeometryType() const override {return EGT_quad_2;} + int testElementExtension(ElementExtension ext) override { return 0; } ///@todo //check this probably ok now when derived from PE-element diff --git a/src/sm/Elements/PlaneStrain/qtrplanestrain.h b/src/sm/Elements/PlaneStrain/qtrplanestrain.h index be92fe589..abeab0378 100644 --- a/src/sm/Elements/PlaneStrain/qtrplanestrain.h +++ b/src/sm/Elements/PlaneStrain/qtrplanestrain.h @@ -77,7 +77,9 @@ public SPRNodalRecoveryModelInterface, public ZZNodalRecoveryModelInterface // definition & identification const char *giveInputRecordName() const override { return _IFT_QTrPlaneStrain_Name; } const char *giveClassName() const override { return "QTrPlaneStrain"; } + Element_Geometry_Type giveGeometryType() const override {return EGT_triangle_2;} + void SPRNodalRecoveryMI_giveSPRAssemblyPoints(IntArray &pap) override; void SPRNodalRecoveryMI_giveDofMansDeterminedByPatch(IntArray &answer, int pap) override; int SPRNodalRecoveryMI_giveNumberOfIP() override; diff --git a/src/sm/Elements/PlaneStrain/quad1planestrain.h b/src/sm/Elements/PlaneStrain/quad1planestrain.h index b89921654..d483e3699 100644 --- a/src/sm/Elements/PlaneStrain/quad1planestrain.h +++ b/src/sm/Elements/PlaneStrain/quad1planestrain.h @@ -93,6 +93,8 @@ class Quad1PlaneStrain : public PlaneStrainElement, public ZZNodalRecoveryModelI // definition & identification const char *giveInputRecordName() const override { return _IFT_Quad1PlaneStrain_Name; } const char *giveClassName() const override { return "Quad1PlaneStrain"; } + Element_Geometry_Type giveGeometryType() const override {return EGT_quad_1;} + void initializeFrom(InputRecord &ir) override; protected: diff --git a/src/sm/Elements/PlaneStrain/trplanestrain.h b/src/sm/Elements/PlaneStrain/trplanestrain.h index 97c3ceed7..ac02c8420 100644 --- a/src/sm/Elements/PlaneStrain/trplanestrain.h +++ b/src/sm/Elements/PlaneStrain/trplanestrain.h @@ -97,6 +97,8 @@ public HuertaErrorEstimatorInterface // definition & identification const char *giveInputRecordName() const override { return _IFT_TrPlaneStrain_Name; } const char *giveClassName() const override { return "TrPlaneStrain"; } + Element_Geometry_Type giveGeometryType() const override {return EGT_triangle_1;} + void initializeFrom(InputRecord &ir) override; protected: diff --git a/src/sm/Elements/PlaneStress/basicelement.C b/src/sm/Elements/PlaneStress/basicelement.C index bc7137a12..da1438c71 100644 --- a/src/sm/Elements/PlaneStress/basicelement.C +++ b/src/sm/Elements/PlaneStress/basicelement.C @@ -46,6 +46,7 @@ FEI2dTrLin BasicElement :: interp(1, 2); BasicElement :: BasicElement(int n, Domain *aDomain) : PlaneStressElement(n, aDomain) { this->numberOfGaussPoints = 1; + this->numberOfDofMans = 3; } diff --git a/src/sm/Elements/PlaneStress/basicelement.h b/src/sm/Elements/PlaneStress/basicelement.h index 159daa4c3..d9193c2c3 100644 --- a/src/sm/Elements/PlaneStress/basicelement.h +++ b/src/sm/Elements/PlaneStress/basicelement.h @@ -75,6 +75,8 @@ class BasicElement : public PlaneStressElement const char *giveInputRecordName() const override { return _IFT_BasicElement_Name; } // Necessary for debug messages: const char *giveClassName() const override { return "BasicElement"; } + Element_Geometry_Type giveGeometryType() const override {return EGT_triangle_1;} + protected: diff --git a/src/sm/Elements/PlaneStress/linquad3d_planestress.C b/src/sm/Elements/PlaneStress/linquad3d_planestress.C index a06893294..82ae30974 100644 --- a/src/sm/Elements/PlaneStress/linquad3d_planestress.C +++ b/src/sm/Elements/PlaneStress/linquad3d_planestress.C @@ -83,7 +83,7 @@ LinQuad3DPlaneStress::giveCellGeometryWrapper() return cellGeometryWrapper; } else { this->computeLocalNodalCoordinates(lc); - return (cellGeometryWrapper = new FEIVertexListGeometryWrapper(lc)); + return (cellGeometryWrapper = new FEIVertexListGeometryWrapper(lc, this->giveGeometryType())); } } @@ -234,7 +234,6 @@ LinQuad3DPlaneStress :: giveCharacteristicTensor(FloatMatrix &answer, CharTensor } else if ( ( type == LocalCurvatureTensor ) || ( type == GlobalCurvatureTensor ) ) { } else { OOFEM_ERROR("unsupported tensor mode"); - exit(1); } if ( ( type == GlobalForceTensor ) || ( type == GlobalMomentTensor ) || diff --git a/src/sm/Elements/PlaneStress/planstrss.h b/src/sm/Elements/PlaneStress/planstrss.h index a0fe0f1c5..90ab080a4 100644 --- a/src/sm/Elements/PlaneStress/planstrss.h +++ b/src/sm/Elements/PlaneStress/planstrss.h @@ -93,6 +93,8 @@ public HuertaErrorEstimatorInterface // definition & identification const char *giveInputRecordName() const override { return _IFT_PlaneStress2d_Name; } const char *giveClassName() const override { return "PlaneStress2d"; } + Element_Geometry_Type giveGeometryType() const override {return EGT_quad_1;} + void initializeFrom(InputRecord &ir) override; protected: diff --git a/src/sm/Elements/PlaneStress/q9planstrss.h b/src/sm/Elements/PlaneStress/q9planstrss.h index 6da5d8bef..74c3845e6 100644 --- a/src/sm/Elements/PlaneStress/q9planstrss.h +++ b/src/sm/Elements/PlaneStress/q9planstrss.h @@ -62,6 +62,8 @@ class Q9PlaneStress2d : public PlaneStressElement, public ZZNodalRecoveryModelIn // definition & identification const char *giveInputRecordName() const override { return _IFT_Q9PlaneStress2d_Name; } const char *giveClassName() const override { return "Q9PlaneStress2d"; } + Element_Geometry_Type giveGeometryType() const override {return EGT_quad9_2;} + FEInterpolation *giveInterpolation() const override; Interface *giveInterface(InterfaceType it) override; diff --git a/src/sm/Elements/PlaneStress/qplanstrss.h b/src/sm/Elements/PlaneStress/qplanstrss.h index 8c81ce056..38160ec60 100644 --- a/src/sm/Elements/PlaneStress/qplanstrss.h +++ b/src/sm/Elements/PlaneStress/qplanstrss.h @@ -63,7 +63,7 @@ class QPlaneStress2d : public PlaneStressElement, public ZZNodalRecoveryModelInt // definition & identification const char *giveInputRecordName() const override { return _IFT_QPlaneStress2d_Name; } const char *giveClassName() const override { return "QPlaneStress2d"; } - + Element_Geometry_Type giveGeometryType() const override { return EGT_quad_2; } Interface *giveInterface(InterfaceType it) override; void NodalAveragingRecoveryMI_computeNodalValue(FloatArray &answer, int node, diff --git a/src/sm/Elements/PlaneStress/qtrplstr.h b/src/sm/Elements/PlaneStress/qtrplstr.h index 79cf89308..236e6dd9d 100644 --- a/src/sm/Elements/PlaneStress/qtrplstr.h +++ b/src/sm/Elements/PlaneStress/qtrplstr.h @@ -74,6 +74,8 @@ public SPRNodalRecoveryModelInterface // definition & identification const char *giveInputRecordName() const override { return _IFT_QTrPlaneStress2d_Name; } const char *giveClassName() const override { return "QTrPlaneStress2d"; } + Element_Geometry_Type giveGeometryType() const override {return EGT_triangle_2;} + void initializeFrom(InputRecord &ir) override; void SPRNodalRecoveryMI_giveSPRAssemblyPoints(IntArray &pap) override; diff --git a/src/sm/Elements/PlaneStress/trplanestressrotallman.C b/src/sm/Elements/PlaneStress/trplanestressrotallman.C index 33819e23f..64f0bef93 100644 --- a/src/sm/Elements/PlaneStress/trplanestressrotallman.C +++ b/src/sm/Elements/PlaneStress/trplanestressrotallman.C @@ -109,8 +109,8 @@ TrPlanestressRotAllman :: computeNmatrixAt(const FloatArray &iLocCoord, FloatMat answer.zero(); this->computeLocalNodalCoordinates(lxy); // get ready for tranformation into 3d - this->qinterpolation.evalN( n, iLocCoord, FEIVertexListGeometryWrapper(lxy) ); - this->interp.evalN( L, iLocCoord, FEIVertexListGeometryWrapper(lxy)); + this->qinterpolation.evalN( n, iLocCoord, FEIVertexListGeometryWrapper(lxy, this->qinterpolation.giveGeometryType()) ); + this->interp.evalN( L, iLocCoord, FEIVertexListGeometryWrapper(lxy, this->interp.giveGeometryType())); answer.at(1, 1) = answer.at(2, 2) = n.at(1) + n.at(4) / 2. + n.at(6) / 2.; answer.at(1, 4) = answer.at(2, 5) = n.at(2) + n.at(4) / 2. + n.at(5) / 2.; @@ -136,7 +136,7 @@ TrPlanestressRotAllman :: computeBmatrixAt(GaussPoint *gp, FloatMatrix &answer, std::vector< FloatArray > lxy; this->computeLocalNodalCoordinates(lxy); // get ready for tranformation into 3d - this->qinterpolation.evaldNdx( dnx, gp->giveNaturalCoordinates(), FEIVertexListGeometryWrapper(lxy) ); + this->qinterpolation.evaldNdx( dnx, gp->giveNaturalCoordinates(), FEIVertexListGeometryWrapper(lxy, this->qinterpolation.giveGeometryType()) ); answer.resize(3, 9); answer.zero(); @@ -194,7 +194,7 @@ TrPlanestressRotAllman :: computeStiffnessMatrixZeroEnergyStabilization(FloatMat std::vector< FloatArray > lxy; this->computeLocalNodalCoordinates(lxy); // get ready for tranformation into 3d - this->qinterpolation.evaldNdx( dnx, lec, FEIVertexListGeometryWrapper(lxy) ); + this->qinterpolation.evaldNdx( dnx, lec, FEIVertexListGeometryWrapper(lxy, this->qinterpolation.giveGeometryType()) ); // evaluate (dv/dx-du/dy)/2. at element center b.at(1, 1) = -1.0 * ( dnx.at(1, 2) + 0.5 * dnx.at(4, 2) + 0.5 * dnx.at(6, 2) ); @@ -261,7 +261,7 @@ TrPlanestressRotAllman :: computeEgdeNMatrixAt(FloatMatrix &answer, int iedge, G FEI2dTrQuad qi(1, 2); this->computeLocalNodalCoordinates(lxy); // get ready for tranformation into 3d - qi.edgeEvalN( n, iedge, gp->giveNaturalCoordinates(), FEIVertexListGeometryWrapper(lxy) ); + qi.edgeEvalN( n, iedge, gp->giveNaturalCoordinates(), FEIVertexListGeometryWrapper(lxy, qi.giveGeometryType()) ); const auto &en = qi.computeLocalEdgeMapping(iedge); // get edge mapping this->interp.edgeEvalN( l, iedge, gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(this) ); answer.resize(3, 6); diff --git a/src/sm/Elements/PlaneStress/trplanestressrotallman3d.C b/src/sm/Elements/PlaneStress/trplanestressrotallman3d.C index b84a2c5e3..c7e14d61e 100644 --- a/src/sm/Elements/PlaneStress/trplanestressrotallman3d.C +++ b/src/sm/Elements/PlaneStress/trplanestressrotallman3d.C @@ -90,7 +90,7 @@ TrPlanestressRotAllman3d :: computeVolumeAround(GaussPoint *gp) this->computeLocalNodalCoordinates(lc); weight = gp->giveWeight(); - detJ = fabs( this->interp.giveTransformationJacobian( gp->giveNaturalCoordinates(), FEIVertexListGeometryWrapper(lc) ) ); + detJ = fabs( this->interp.giveTransformationJacobian( gp->giveNaturalCoordinates(), FEIVertexListGeometryWrapper(lc, this->interp.giveGeometryType()) ) ); return detJ * weight * this->giveStructuralCrossSection()->give(CS_Thickness, gp); } @@ -201,7 +201,6 @@ TrPlanestressRotAllman3d :: giveCharacteristicTensor(FloatMatrix &answer, CharTe answer.at(2, 1) = charVect.at(3) / 2.; } else if ( ( type == LocalCurvatureTensor ) || ( type == GlobalCurvatureTensor ) ) {} else { OOFEM_ERROR("unsupported tensor mode"); - exit(1); } if ( ( type == GlobalForceTensor ) || ( type == GlobalMomentTensor ) || diff --git a/src/sm/Elements/PlaneStress/trplanrot3d.C b/src/sm/Elements/PlaneStress/trplanrot3d.C index 3b7cedeb8..ab27a934d 100644 --- a/src/sm/Elements/PlaneStress/trplanrot3d.C +++ b/src/sm/Elements/PlaneStress/trplanrot3d.C @@ -61,7 +61,6 @@ TrPlaneStrRot3d :: giveLocalCoordinates(FloatArray &answer, const FloatArray &gl // test the parameter if ( global.giveSize() != 3 ) { OOFEM_ERROR("cannot transform coordinates - size mismatch"); - exit(1); } // first ensure that receiver's GtoLRotationMatrix[3,3] is defined @@ -85,7 +84,7 @@ TrPlaneStrRot3d :: computeVolumeAround(GaussPoint *gp) std :: vector< FloatArray > lc = {{x[0], y[0]}, {x[1], y[1]}, {x[2], y[2]}}; weight = gp->giveWeight(); - detJ = fabs( this->interp.giveTransformationJacobian( gp->giveNaturalCoordinates(), FEIVertexListGeometryWrapper(lc) ) ); + detJ = fabs( this->interp.giveTransformationJacobian( gp->giveNaturalCoordinates(), FEIVertexListGeometryWrapper(lc, this->interp.giveGeometryType()) ) ); return detJ * weight * this->giveStructuralCrossSection()->give(CS_Thickness, gp); } @@ -232,7 +231,6 @@ TrPlaneStrRot3d :: giveCharacteristicTensor(FloatMatrix &answer, CharTensor type answer.at(3, 3) = charVect.at(4); } else { OOFEM_ERROR("unsupported tensor mode"); - exit(1); } if ( type == GlobalForceTensor || type == GlobalMomentTensor || diff --git a/src/sm/Elements/PlaneStress/trplanstrss.C b/src/sm/Elements/PlaneStress/trplanstrss.C index 22fafc929..79f28a208 100644 --- a/src/sm/Elements/PlaneStress/trplanstrss.C +++ b/src/sm/Elements/PlaneStress/trplanstrss.C @@ -181,7 +181,6 @@ TrPlaneStress2d :: giveCharacteristicSize(GaussPoint *gp, FloatArray &normalToCr } OOFEM_ERROR("invalid method"); - return 0.; } diff --git a/src/sm/Elements/PlaneStress/trplanstrss.h b/src/sm/Elements/PlaneStress/trplanstrss.h index dd639e3b2..f0df4b294 100644 --- a/src/sm/Elements/PlaneStress/trplanstrss.h +++ b/src/sm/Elements/PlaneStress/trplanstrss.h @@ -78,6 +78,7 @@ public LayeredCrossSectionInterface double giveCharacteristicSize(GaussPoint *gp, FloatArray &normalToCrackPlane, ElementCharSizeMethod method) override; double giveParentElSize() const override { return 0.5; } Interface *giveInterface(InterfaceType) override; + Element_Geometry_Type giveGeometryType() const override { return EGT_triangle_1; } #ifdef __OOFEG void drawRawGeometry(oofegGraphicContext &gc, TimeStep *tStep) override; diff --git a/src/sm/Elements/Plates/cct.C b/src/sm/Elements/Plates/cct.C index 00aaed912..41dd96239 100644 --- a/src/sm/Elements/Plates/cct.C +++ b/src/sm/Elements/Plates/cct.C @@ -356,7 +356,7 @@ CCTPlate::computeVolumeAround(GaussPoint *gp) lc [ 0 ].at(3), lc [ 1 ].at(3), lc [ 2 ].at(3) ); weight = gp->giveWeight(); - detJ = fabs(this->interp_lin.giveTransformationJacobian(gp->giveNaturalCoordinates(), FEIVertexListGeometryWrapper(lc) ) ); + detJ = fabs(this->interp_lin.giveTransformationJacobian(gp->giveNaturalCoordinates(), FEIVertexListGeometryWrapper(lc, this->interp_lin.giveGeometryType()) ) ); return detJ * weight; ///@todo What about thickness? } diff --git a/src/sm/Elements/Plates/cct.h b/src/sm/Elements/Plates/cct.h index 9f67eba80..04ef1b825 100644 --- a/src/sm/Elements/Plates/cct.h +++ b/src/sm/Elements/Plates/cct.h @@ -77,6 +77,8 @@ class CCTPlate : public StructuralElement, int testElementExtension(ElementExtension ext) override { return ( ( ext == Element_EdgeLoadSupport ) ? 1 : 0 ); } // overloaded to take into account possible element local cs (in derived cct3d) double computeArea() override; + Element_Geometry_Type giveGeometryType() const override {return EGT_triangle_1;} + protected: void computeGaussPoints() override; diff --git a/src/sm/Elements/Plates/dkt.C b/src/sm/Elements/Plates/dkt.C index 1ff15843e..df90aee68 100644 --- a/src/sm/Elements/Plates/dkt.C +++ b/src/sm/Elements/Plates/dkt.C @@ -394,7 +394,7 @@ DKTPlate::computeVolumeAround(GaussPoint *gp) lc [ 0 ].at(3), lc [ 1 ].at(3), lc [ 2 ].at(3) ); weight = gp->giveWeight(); - detJ = fabs(this->interp_lin.giveTransformationJacobian(gp->giveNaturalCoordinates(), FEIVertexListGeometryWrapper(lc) ) ); + detJ = fabs(this->interp_lin.giveTransformationJacobian(gp->giveNaturalCoordinates(), FEIVertexListGeometryWrapper(lc, this->giveGeometryType()) ) ); return detJ * weight; ///@todo What about thickness? } diff --git a/src/sm/Elements/Plates/dkt.h b/src/sm/Elements/Plates/dkt.h index 5e4cf1009..e743b45f2 100644 --- a/src/sm/Elements/Plates/dkt.h +++ b/src/sm/Elements/Plates/dkt.h @@ -86,6 +86,8 @@ class DKTPlate : public StructuralElement, FEInterpolation *giveInterpolation(DofIDItem id) const override; MaterialMode giveMaterialMode() override { return _2dPlate; } + Element_Geometry_Type giveGeometryType() const override {return EGT_triangle_1;} + int testElementExtension(ElementExtension ext) override { return ( ( ( ext == Element_EdgeLoadSupport ) || ( ext == Element_SurfaceLoadSupport ) ) ? 1 : 0 ); } void computeEdgeNMatrix(FloatMatrix &answer, int boundaryID, const FloatArray &lcoords) override; diff --git a/src/sm/Elements/Plates/dkt3d.C b/src/sm/Elements/Plates/dkt3d.C index 6f56cad1d..2ba86ed86 100644 --- a/src/sm/Elements/Plates/dkt3d.C +++ b/src/sm/Elements/Plates/dkt3d.C @@ -208,7 +208,6 @@ DKTPlate3d::giveCharacteristicTensor(FloatMatrix &answer, CharTensor type, Gauss answer.at(2, 1) = charVect.at(3) / 2.; } else { OOFEM_ERROR("unsupported tensor mode"); - exit(1); } if ( ( type == GlobalForceTensor ) || ( type == GlobalMomentTensor ) || @@ -481,7 +480,7 @@ DKTPlate3d::computeLocalCoordinates(FloatArray &answer, const FloatArray &coords this->giveLocalCoordinates(lc [ _i ], this->giveNode(_i + 1)->giveCoordinates() ); } FEI2dTrLin _interp(1, 2); - bool inplane = _interp.global2local( llc, inputCoords_ElCS, FEIVertexListGeometryWrapper(lc) ) > 0; + bool inplane = _interp.global2local( llc, inputCoords_ElCS, FEIVertexListGeometryWrapper(lc, this->giveGeometryType()) ) > 0; answer.resize(2); answer.at(1) = inputCoords_ElCS.at(1); answer.at(2) = inputCoords_ElCS.at(2); diff --git a/src/sm/Elements/Plates/dkt3d.h b/src/sm/Elements/Plates/dkt3d.h index 72090e079..e41a88b09 100644 --- a/src/sm/Elements/Plates/dkt3d.h +++ b/src/sm/Elements/Plates/dkt3d.h @@ -127,7 +127,6 @@ class DKTPlate3d : public DKTPlate int giveLocalCoordinateSystem(FloatMatrix &answer) override { OOFEM_ERROR("calling of this function id not allowed"); - return 0; } int testElementExtension(ElementExtension ext) override { return ( ( ext == Element_SurfaceLoadSupport ) ? 1 : 0 ); } diff --git a/src/sm/Elements/Plates/qdkt.h b/src/sm/Elements/Plates/qdkt.h index 520cf65fe..365fae4ed 100644 --- a/src/sm/Elements/Plates/qdkt.h +++ b/src/sm/Elements/Plates/qdkt.h @@ -78,6 +78,7 @@ class QDKTPlate : public StructuralElement, FEInterpolation *giveInterpolation(DofIDItem id) const override; MaterialMode giveMaterialMode() override { return _2dPlate; } + Element_Geometry_Type giveGeometryType() const override {return EGT_quad_1;} int testElementExtension(ElementExtension ext) override { return ( ( ( ext == Element_EdgeLoadSupport ) || ( ext == Element_SurfaceLoadSupport ) ) ? 1 : 0 ); } protected: diff --git a/src/sm/Elements/Plates/quad1mindlin.h b/src/sm/Elements/Plates/quad1mindlin.h index acd45d319..244489340 100644 --- a/src/sm/Elements/Plates/quad1mindlin.h +++ b/src/sm/Elements/Plates/quad1mindlin.h @@ -86,6 +86,8 @@ class Quad1Mindlin : public StructuralElement, int computeNumberOfDofs() override { return 12; } void giveDofManDofIDMask(int inode, IntArray &) const override; + Element_Geometry_Type giveGeometryType() const override {return EGT_quad_1;} + void computeMidPlaneNormal(FloatArray &answer, const GaussPoint *gp) override; diff --git a/src/sm/Elements/Shells/cct3d.C b/src/sm/Elements/Shells/cct3d.C index 271df6e62..ce87f1fb7 100644 --- a/src/sm/Elements/Shells/cct3d.C +++ b/src/sm/Elements/Shells/cct3d.C @@ -114,7 +114,7 @@ CCTPlate3d::computeLocalCoordinates(FloatArray &answer, const FloatArray &coords this->giveLocalCoordinates(lc [ _i ], this->giveNode(_i + 1)->giveCoordinates() ); } FEI2dTrLin _interp(1, 2); - bool inplane = _interp.global2local( llc, inputCoords_ElCS, FEIVertexListGeometryWrapper(lc) ) > 0; + bool inplane = _interp.global2local( llc, inputCoords_ElCS, FEIVertexListGeometryWrapper(lc, this->giveGeometryType()) ) > 0; answer.resize(2); answer.at(1) = inputCoords_ElCS.at(1); answer.at(2) = inputCoords_ElCS.at(2); @@ -250,7 +250,6 @@ CCTPlate3d::giveCharacteristicTensor(FloatMatrix &answer, CharTensor type, Gauss answer.at(2, 1) = charVect.at(3) / 2.; } else { OOFEM_ERROR("unsupported tensor mode"); - exit(1); } if ( ( type == GlobalForceTensor ) || ( type == GlobalMomentTensor ) || diff --git a/src/sm/Elements/Shells/cct3d.h b/src/sm/Elements/Shells/cct3d.h index 9c12332c6..b65d1ea8c 100644 --- a/src/sm/Elements/Shells/cct3d.h +++ b/src/sm/Elements/Shells/cct3d.h @@ -122,7 +122,6 @@ class CCTPlate3d : public CCTPlate int giveLocalCoordinateSystem(FloatMatrix &answer) override { OOFEM_ERROR("calling of this function id not allowed"); - return 0; } int testElementExtension(ElementExtension ext) override { return ( ( ext == Element_SurfaceLoadSupport ) ? 1 : 0 ); } diff --git a/src/sm/Elements/Shells/mitc4.C b/src/sm/Elements/Shells/mitc4.C index 7ee0b0f84..c0c691ff6 100644 --- a/src/sm/Elements/Shells/mitc4.C +++ b/src/sm/Elements/Shells/mitc4.C @@ -929,7 +929,7 @@ MITC4Shell::computeLocalCoordinates(FloatArray &answer, const FloatArray &coords for ( int _i = 0; _i < 4; _i++ ) { lc [ _i ] = this->giveLocalCoordinates( this->giveNode(_i + 1)->giveCoordinates() ); } - bool inplane = interp_lin.global2local(llc, inputCoords_ElCS, FEIVertexListGeometryWrapper(lc) ) > 0; + bool inplane = interp_lin.global2local(llc, inputCoords_ElCS, FEIVertexListGeometryWrapper(lc, interp_lin.giveGeometryType()) ) > 0; answer.resize(2); answer.at(1) = inputCoords_ElCS.at(1); answer.at(2) = inputCoords_ElCS.at(2); @@ -1080,7 +1080,7 @@ MITC4Shell::computeEdgeVolumeAround(GaussPoint *gp, int iEdge) lc [ 1 ] = lcF [ 1 ]; lc [ 2 ] = lcF [ 2 ]; lc [ 3 ] = lcF [ 3 ]; - double detJ = this->interp_lin.edgeGiveTransformationJacobian(iEdge, gp->giveNaturalCoordinates(), FEIVertexListGeometryWrapper(lc) ); + double detJ = this->interp_lin.edgeGiveTransformationJacobian(iEdge, gp->giveNaturalCoordinates(), FEIVertexListGeometryWrapper(lc, interp_lin.giveGeometryType()) ); return detJ * gp->giveWeight(); } diff --git a/src/sm/Elements/Shells/mitc4.h b/src/sm/Elements/Shells/mitc4.h index 5deac9866..119387d7b 100644 --- a/src/sm/Elements/Shells/mitc4.h +++ b/src/sm/Elements/Shells/mitc4.h @@ -101,6 +101,8 @@ class MITC4Shell : public StructuralElement, public ZZNodalRecoveryModelInterfac void postInitialize() override; int computeNumberOfDofs() override { return 24; } int computeNumberOfGlobalDofs() override { return 24; } + Element_Geometry_Type giveGeometryType() const override {return EGT_quad_1;} + void SPRNodalRecoveryMI_giveSPRAssemblyPoints(IntArray &pap) override; void SPRNodalRecoveryMI_giveDofMansDeterminedByPatch(IntArray &answer, int pap) override; diff --git a/src/sm/Elements/Shells/quad1mindlinshell3d.C b/src/sm/Elements/Shells/quad1mindlinshell3d.C index cafdd9ddd..681438ce6 100644 --- a/src/sm/Elements/Shells/quad1mindlinshell3d.C +++ b/src/sm/Elements/Shells/quad1mindlinshell3d.C @@ -185,7 +185,7 @@ Quad1MindlinShell3D::computeBmatrixAt(GaussPoint *gp, FloatMatrix &answer, int l { const auto &localCoords = gp->giveNaturalCoordinates(); - auto tmp = this->interp.evaldNdx( localCoords, FEIVertexListGeometryWrapper(lnodes) ); + auto tmp = this->interp.evaldNdx( localCoords, FEIVertexListGeometryWrapper(lnodes, this->giveGeometryType()) ); auto dn = tmp.second; auto n = this->interp.evalN(localCoords); @@ -194,7 +194,7 @@ Quad1MindlinShell3D::computeBmatrixAt(GaussPoint *gp, FloatMatrix &answer, int l FloatMatrixF< 2, 4 >dns; if ( this->reducedIntegrationFlag ) { FloatArray lc(2); // set to element center coordinates - auto tmp = this->interp.evaldNdx( lc, FEIVertexListGeometryWrapper(lnodes) ); + auto tmp = this->interp.evaldNdx( lc, FEIVertexListGeometryWrapper(lnodes, this->giveGeometryType()) ); dns = tmp.second; ns = this->interp.evalN(lc); } else { @@ -487,7 +487,7 @@ double Quad1MindlinShell3D::computeVolumeAround(GaussPoint *gp) { double weight = gp->giveWeight(); - double detJ = fabs(this->interp.giveTransformationJacobian(gp->giveNaturalCoordinates(), FEIVertexListGeometryWrapper(lnodes) ) ); + double detJ = fabs(this->interp.giveTransformationJacobian(gp->giveNaturalCoordinates(), FEIVertexListGeometryWrapper(lnodes, this->giveGeometryType()) ) ); return detJ * weight; } @@ -569,7 +569,7 @@ Quad1MindlinShell3D::giveEdgeDofMapping(IntArray &answer, int iEdge) const double Quad1MindlinShell3D::computeEdgeVolumeAround(GaussPoint *gp, int iEdge) { - double detJ = this->interp.edgeGiveTransformationJacobian(iEdge, gp->giveNaturalCoordinates(), FEIVertexListGeometryWrapper(lnodes) ); + double detJ = this->interp.edgeGiveTransformationJacobian(iEdge, gp->giveNaturalCoordinates(), FEIVertexListGeometryWrapper(lnodes, this->giveGeometryType()) ); return detJ * gp->giveWeight(); } diff --git a/src/sm/Elements/Shells/quad1mindlinshell3d.h b/src/sm/Elements/Shells/quad1mindlinshell3d.h index 08bd02a99..c111b04e6 100644 --- a/src/sm/Elements/Shells/quad1mindlinshell3d.h +++ b/src/sm/Elements/Shells/quad1mindlinshell3d.h @@ -105,6 +105,8 @@ class Quad1MindlinShell3D : public StructuralElement, int computeNumberOfDofs() override { return 24; } int computeNumberOfGlobalDofs() override { return 24; } void giveDofManDofIDMask(int inode, IntArray &) const override; + Element_Geometry_Type giveGeometryType() const override {return EGT_quad_1;} + void computeMidPlaneNormal(FloatArray &answer, const GaussPoint *gp) override; diff --git a/src/sm/Elements/Shells/rershell.C b/src/sm/Elements/Shells/rershell.C index ed7427744..e5ac4f7d9 100644 --- a/src/sm/Elements/Shells/rershell.C +++ b/src/sm/Elements/Shells/rershell.C @@ -556,7 +556,6 @@ RerShell :: giveCharacteristicTensor(FloatMatrix &answer, CharTensor type, Gauss answer.at(2, 1) = curv.at(6) / 2.; } else { OOFEM_ERROR("unsupported tensor mode"); - exit(1); } if ( ( type == GlobalForceTensor ) || ( type == GlobalMomentTensor ) || diff --git a/src/sm/Elements/Shells/shell7base.C b/src/sm/Elements/Shells/shell7base.C index 9ed906d79..3c8783c2f 100644 --- a/src/sm/Elements/Shells/shell7base.C +++ b/src/sm/Elements/Shells/shell7base.C @@ -325,7 +325,7 @@ Shell7Base :: setupInitialNodeDirectors() // Compute directors as normals to the surface FloatArray lcoords; FloatMatrix localNodeCoords; - this->giveInterpolation()->giveLocalNodeCoords(localNodeCoords); + this->giveInterpolation()->giveLocalNodeCoords(localNodeCoords, this->giveGeometryType()); int nDofMan = this->giveNumberOfDofManagers(); this->initialNodeDirectors.resize(nDofMan); @@ -1962,7 +1962,7 @@ Shell7Base :: CopyIPvaluesToNodes(std::vector &recoveredValues, int // composite element interpolator FloatMatrix localNodeCoords; - this->interpolationForExport.giveLocalNodeCoords(localNodeCoords); + this->interpolationForExport.giveLocalNodeCoords(localNodeCoords, this->giveGeometryType()); int numNodes = localNodeCoords.giveNumberOfColumns(); recoveredValues.resize(numNodes); @@ -2010,7 +2010,7 @@ Shell7Base :: nodalLeastSquareFitFromIP(std::vector &recoveredValues // composite element interpolator FloatMatrix localNodeCoords; - this->interpolationForExport.giveLocalNodeCoords(localNodeCoords); + this->interpolationForExport.giveLocalNodeCoords(localNodeCoords, EGT_wedge_2); int numNodes = localNodeCoords.giveNumberOfColumns(); recoveredValues.resize(numNodes); @@ -2052,7 +2052,7 @@ Shell7Base :: nodalLeastSquareFitFromIP(std::vector &recoveredValues auto nodes = giveFictiousNodeCoordsForExport(layer); FEInterpolation *interpol = static_cast< FEInterpolation * >( &this->interpolationForExport ); FloatArray N; - interpol->evalN( N, ip->giveNaturalCoordinates(), FEIVertexListGeometryWrapper( nodes ) ); + interpol->evalN( N, ip->giveNaturalCoordinates(), FEIVertexListGeometryWrapper( nodes, this->giveGeometryType() ) ); Nbar.addSubVectorRow(N,i+1,1); } // Nhat = inv(Nbar^T*Nbar)*Nbar^T @@ -2080,7 +2080,7 @@ Shell7Base :: giveL2contribution(FloatMatrix &ipValues, FloatMatrix &Nbar, int l { // composite element interpolator FloatMatrix localNodeCoords; - this->interpolationForExport.giveLocalNodeCoords(localNodeCoords); + this->interpolationForExport.giveLocalNodeCoords(localNodeCoords, EGT_wedge_2); int numNodes = localNodeCoords.giveNumberOfColumns(); @@ -2106,7 +2106,7 @@ Shell7Base :: giveL2contribution(FloatMatrix &ipValues, FloatMatrix &Nbar, int l auto nodes = giveFictiousNodeCoordsForExport(layer); FEInterpolation *interpol = static_cast< FEInterpolation * >( &this->interpolationForExport ); FloatArray N; - interpol->evalN( N, ip->giveNaturalCoordinates(), FEIVertexListGeometryWrapper( nodes ) ); + interpol->evalN( N, ip->giveNaturalCoordinates(), FEIVertexListGeometryWrapper( nodes, this->giveGeometryType() ) ); Nbar.addSubVectorRow(N,i+1,1); } } @@ -3067,7 +3067,7 @@ Shell7Base :: giveFictiousNodeCoordsForExport(int layer) { // compute fictious node coords FloatMatrix localNodeCoords; - this->interpolationForExport.giveLocalNodeCoords(localNodeCoords); + this->interpolationForExport.giveLocalNodeCoords(localNodeCoords, EGT_wedge_2); std::vector nodes(localNodeCoords.giveNumberOfColumns()); for ( int i = 1; i <= localNodeCoords.giveNumberOfColumns(); i++ ){ @@ -3085,7 +3085,7 @@ Shell7Base :: giveFictiousCZNodeCoordsForExport(int interface) { // compute fictious node coords FloatMatrix localNodeCoords; - this->interpolationForCZExport.giveLocalNodeCoords(localNodeCoords); + this->interpolationForCZExport.giveLocalNodeCoords(localNodeCoords, EGT_triangle_2); std::vector nodes(localNodeCoords.giveNumberOfColumns()); for ( int i = 1; i <= localNodeCoords.giveNumberOfColumns(); i++ ){ @@ -3104,7 +3104,7 @@ Shell7Base :: giveFictiousUpdatedNodeCoordsForExport(int layer, TimeStep *tStep) // compute fictious node coords FloatMatrix localNodeCoords; - this->interpolationForExport.giveLocalNodeCoords(localNodeCoords); + this->interpolationForExport.giveLocalNodeCoords(localNodeCoords, EGT_wedge_2); std::vector nodes(localNodeCoords.giveNumberOfColumns()); for ( int i = 1; i <= localNodeCoords.giveNumberOfColumns(); i++ ){ FloatArray localCoords(3); diff --git a/src/sm/Elements/Shells/shell7basexfem.C b/src/sm/Elements/Shells/shell7basexfem.C index 51f0534a6..63e3a62b4 100644 --- a/src/sm/Elements/Shells/shell7basexfem.C +++ b/src/sm/Elements/Shells/shell7basexfem.C @@ -798,7 +798,7 @@ Shell7BaseXFEM :: computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rM { this->OLDcomputeStiffnessMatrix(answer, rMode, tStep); return; - +#if 0 int ndofs = this->giveNumberOfDofs(); answer.resize(ndofs, ndofs); answer.zero(); @@ -954,7 +954,7 @@ Shell7BaseXFEM :: computeStiffnessMatrix(FloatMatrix &answer, MatResponseMode rM } } #endif - +#endif } @@ -1620,7 +1620,7 @@ Shell7BaseXFEM :: edgeEvalEnrCovarBaseVectorsAt(const FloatArrayF<3> &lcoords, c FloatArray solVecEdge; FloatMatrix B; - const auto &edgeNodes = this->fei->computeLocalEdgeMapping(iedge); + //const auto &edgeNodes = this->fei->computeLocalEdgeMapping(iedge); this->edgeComputeEnrichedBmatrixAt(lcoords, B, ei, iedge); this->edgeGiveUpdatedSolutionVector(solVecEdge, iedge, tStep); @@ -2316,7 +2316,7 @@ Shell7BaseXFEM :: giveShellExportData(ExportRegion &vtkPiece, IntArray &primaryV for ( int subCell = 1; subCell <= numSubCells; subCell++ ) { FloatArray nodeLocalXi1Coords, nodeLocalXi2Coords, nodeLocalXi3Coords, nodeLocalXi3CoordsMapped; if ( numSubCells == 1) { - this->interpolationForExport.giveLocalNodeCoords(localNodeCoords); + this->interpolationForExport.giveLocalNodeCoords(localNodeCoords, EGT_wedge_2); } else { giveLocalNodeCoordsForExport(nodeLocalXi1Coords, nodeLocalXi2Coords, nodeLocalXi3Coords, subCell, layer, localNodeCoords); } @@ -2415,7 +2415,7 @@ Shell7BaseXFEM :: giveFictiousUpdatedNodeCoordsForExport(int layer, TimeStep *tS if ( subCell == 0) { - this->interpolationForExport.giveLocalNodeCoords(localNodeCoords); + this->interpolationForExport.giveLocalNodeCoords(localNodeCoords, EGT_wedge_2); // must get local z-coord in terms of the total thickness not layerwise } else { giveLocalNodeCoordsForExport(nodeLocalXi1Coords, nodeLocalXi2Coords, nodeLocalXi3Coords, subCell, layer, localNodeCoords); @@ -2449,7 +2449,7 @@ Shell7BaseXFEM :: giveFictiousUpdatedCZNodeCoordsForExport(int interface, TimeSt if ( subCell == 0) { - this->interpolationForCZExport.giveLocalNodeCoords(localNodeCoords); + this->interpolationForCZExport.giveLocalNodeCoords(localNodeCoords, EGT_triangle_2); // must get local z-coord in terms of the total thickness not layerwise } else { giveLocalCZNodeCoordsForExport(nodeLocalXi1Coords, nodeLocalXi2Coords, nodeLocalXi3Coords, subCell, localNodeCoords); @@ -2813,7 +2813,7 @@ Shell7BaseXFEM :: recoverValuesFromCZIP(std::vector &recoveredValues // composite element interpolator FloatMatrix localNodeCoords; //this->interpolationForExport.giveLocalNodeCoords(localNodeCoords); - this->interpolationForCZExport.giveLocalNodeCoords(localNodeCoords); + this->interpolationForCZExport.giveLocalNodeCoords(localNodeCoords, EGT_triangle_2); int numNodes = localNodeCoords.giveNumberOfColumns(); recoveredValues.resize(numNodes); diff --git a/src/sm/Elements/Shells/tr_shell01.C b/src/sm/Elements/Shells/tr_shell01.C index 05050afc1..a612234e7 100644 --- a/src/sm/Elements/Shells/tr_shell01.C +++ b/src/sm/Elements/Shells/tr_shell01.C @@ -54,8 +54,8 @@ IntArray TR_SHELL01 :: loc_plate = {3, 4, 5, 9, 10, 11, 15, 16, 17}; IntArray TR_SHELL01 :: loc_membrane = {1, 2, 6, 7, 8, 12, 13, 14, 18}; TR_SHELL01 :: TR_SHELL01(int n, Domain *aDomain) : StructuralElement(n, aDomain), ZZNodalRecoveryModelInterface(this), ZZErrorEstimatorInterface(this), SpatialLocalizerInterface(this), - plate(std::make_unique(-1, aDomain)), - membrane(std::make_unique(-1, aDomain)) + plate(std::make_unique(n, aDomain)), + membrane(std::make_unique(n, aDomain)) { numberOfDofMans = 3; } diff --git a/src/sm/Elements/Shells/tr_shell02.C b/src/sm/Elements/Shells/tr_shell02.C index 14a909e12..85853be25 100644 --- a/src/sm/Elements/Shells/tr_shell02.C +++ b/src/sm/Elements/Shells/tr_shell02.C @@ -55,8 +55,8 @@ IntArray TR_SHELL02 :: loc_plate = {3, 4, 5, 9, 10, 11, 15, 16, 17}; IntArray TR_SHELL02 :: loc_membrane = {1, 2, 6, 7, 8, 12, 13, 14, 18}; TR_SHELL02 :: TR_SHELL02(int n, Domain *aDomain) : StructuralElement(n, aDomain), ZZNodalRecoveryModelInterface(this), ZZErrorEstimatorInterface(this), SpatialLocalizerInterface(this), - plate(std::make_unique(-1, aDomain)), - membrane(std::make_unique(-1, aDomain)) + plate(std::make_unique(n, aDomain)), + membrane(std::make_unique(n, aDomain)) { numberOfDofMans = 3; } diff --git a/src/sm/Elements/Shells/tr_shell11.C b/src/sm/Elements/Shells/tr_shell11.C index bcd2cc2c9..872d9b726 100644 --- a/src/sm/Elements/Shells/tr_shell11.C +++ b/src/sm/Elements/Shells/tr_shell11.C @@ -474,7 +474,6 @@ TR_SHELL11 :: giveLocalCoordinates(FloatArray &answer, const FloatArray &global) // test the parameter if ( global.giveSize() != 3 ) { OOFEM_ERROR("cannot transform coordinates - size mismatch"); - exit(1); } // first ensure that receiver's GtoLRotationMatrix[3,3] is defined @@ -498,7 +497,7 @@ TR_SHELL11 :: computeVolumeAround(GaussPoint *gp) std :: vector< FloatArray > lc = {{x[0], y[0]}, {x[1], y[1]}, {x[2], y[2]}}; weight = gp->giveWeight(); - detJ = fabs( this->interp_lin.giveTransformationJacobian( gp->giveNaturalCoordinates(), FEIVertexListGeometryWrapper(lc) ) ); + detJ = fabs( this->interp_lin.giveTransformationJacobian( gp->giveNaturalCoordinates(), FEIVertexListGeometryWrapper(lc, this->giveGeometryType()) ) ); return detJ * weight; // * this->giveStructuralCrossSection()->give(CS_Thickness, gp); } @@ -682,7 +681,6 @@ TR_SHELL11 :: giveCharacteristicTensor(FloatMatrix &answer, CharTensor type, Gau } else { OOFEM_ERROR("unsupported tensor mode"); - exit(1); } if ( type == GlobalForceTensor || type == GlobalMomentTensor || diff --git a/src/sm/Elements/htselement.h b/src/sm/Elements/htselement.h index 5030c227a..292924123 100644 --- a/src/sm/Elements/htselement.h +++ b/src/sm/Elements/htselement.h @@ -64,6 +64,8 @@ class HTSelement : public StructuralElement const char *giveInputRecordName() const override { return _IFT_HTSelement_Name; } const char *giveClassName() const override { return "HTSelement"; } + Element_Geometry_Type giveGeometryType() const override {return EGT_unknown;} + protected: void computeBmatrixAt(GaussPoint *gp, FloatMatrix &answer, int, int) override { } diff --git a/src/sm/Elements/igaelements.C b/src/sm/Elements/igaelements.C index 11b837089..48a1d49af 100644 --- a/src/sm/Elements/igaelements.C +++ b/src/sm/Elements/igaelements.C @@ -155,7 +155,7 @@ void BsplinePlaneStressElement :: drawScalar(oofegGraphicContext &gc, TimeStep * EASValsSetFillStyle(FILL_SOLID); const FloatArray *knotVector = interp->giveKnotVector(); const IntArray *span; - int j, nsd = this->giveNsd(); + int j, nsd = this->giveNsd(this->giveGeometryType()); FloatArray c [ 4 ], cg [ 4 ], u; IntArray sign [ 4 ]; @@ -267,7 +267,7 @@ void NURBSPlaneStressElement :: drawScalar(oofegGraphicContext &gc, TimeStep *tS EASValsSetEdgeFlag(true); const FloatArray *knotVector = interp->giveKnotVector(); const IntArray *span; - int j, nsd = this->giveNsd(); + int j, nsd = this->giveNsd(this->giveGeometryType()); FloatArray c [ 4 ], cg [ 4 ]; IntArray sign [ 4 ]; @@ -469,7 +469,7 @@ void TSplinePlaneStressElement :: drawScalar(oofegGraphicContext &gc, TimeStep * EASValsSetEdgeFlag(true); const FloatArray *knotVector = interp->giveKnotVector(); const IntArray *span; - int j, nsd = this->giveNsd(); + int j, nsd = this->giveNsd(this->giveGeometryType()); FloatArray c [ 4 ], cg [ 4 ], u; IntArray sign [ 4 ]; @@ -582,7 +582,7 @@ void NURBSSpace3dElement :: drawScalar(oofegGraphicContext &gc, TimeStep *tStep) EASValsSetEdgeFlag(true); const FloatArray *knotVector = interp->giveKnotVector(); const IntArray *span; - int j, nsd = this->giveNsd(); + int j, nsd = this->giveNsd(this->giveGeometryType()); FloatArray c [ 8 ], cg [ 8 ]; IntArray sign [ 8 ]; diff --git a/src/sm/Elements/igaelements.h b/src/sm/Elements/igaelements.h index 3f83b49dd..53a75b28d 100644 --- a/src/sm/Elements/igaelements.h +++ b/src/sm/Elements/igaelements.h @@ -80,6 +80,8 @@ class BsplinePlaneStressElement : public IGAElement, public PlaneStressStructura // definition & identification const char *giveInputRecordName() const override { return _IFT_BsplinePlaneStressElement_Name; } const char *giveClassName() const override { return "BsplinePlaneStressElement"; } + Element_Geometry_Type giveGeometryType() const override {return EGT_unknown;} + #ifdef __OOFEG // Graphics output @@ -90,7 +92,7 @@ class BsplinePlaneStressElement : public IGAElement, public PlaneStressStructura #endif protected: - int giveNsd() override { return 2; } + int giveNsd(const Element_Geometry_Type) override { return 2; } }; @@ -122,6 +124,7 @@ class NURBSPlaneStressElement : public IGAElement, public PlaneStressStructuralE // definition & identification const char *giveInputRecordName() const override { return _IFT_NURBSPlaneStressElement_Name; } const char *giveClassName() const override { return "NURBSPlaneStressElement"; } + Element_Geometry_Type giveGeometryType() const override {return EGT_unknown;} #ifdef __OOFEG // // Graphics output @@ -134,7 +137,7 @@ class NURBSPlaneStressElement : public IGAElement, public PlaneStressStructuralE #endif protected: - int giveNsd() override { return 2; } + int giveNsd(const Element_Geometry_Type) override { return 2; } }; @@ -169,13 +172,15 @@ class TSplinePlaneStressElement : public IGATSplineElement, public PlaneStressSt // definition & identification const char *giveInputRecordName() const override { return _IFT_TSplinePlaneStressElement_Name; } const char *giveClassName() const override { return "TSplinePlaneStressElement"; } + Element_Geometry_Type giveGeometryType() const override {return EGT_unknown;} + #ifdef __OOFEG // Graphics output void drawScalar(oofegGraphicContext &gc, TimeStep *tStep) override; #endif protected: - int giveNsd() override { return 2; } + int giveNsd(const Element_Geometry_Type) override { return 2; } }; @@ -208,6 +213,8 @@ class NURBSSpace3dElement : public IGAElement, public Space3dStructuralElementEv // definition & identification const char *giveInputRecordName() const override { return _IFT_NURBSSpace3dElement_Name; } const char *giveClassName() const override { return "NURBSSpace3dElement"; } + Element_Geometry_Type giveGeometryType() const override {return EGT_unknown;} + #ifdef __OOFEG // Graphics output void drawScalar(oofegGraphicContext &gc, TimeStep *tStep) override; @@ -217,7 +224,7 @@ class NURBSSpace3dElement : public IGAElement, public Space3dStructuralElementEv #endif protected: - int giveNsd() override { return 3; } + int giveNsd(const Element_Geometry_Type) override { return 3; } }; } // end namespace oofem #endif //igaelements_h diff --git a/src/sm/Elements/linedistributedspring.h b/src/sm/Elements/linedistributedspring.h index fb7a88a96..fe1602583 100644 --- a/src/sm/Elements/linedistributedspring.h +++ b/src/sm/Elements/linedistributedspring.h @@ -74,6 +74,8 @@ public SPRNodalRecoveryModelInterface // definition & identification const char *giveInputRecordName() const override { return _IFT_LineDistributedSpring_Name; } const char *giveClassName() const override { return "LineDistributedSpring"; } + Element_Geometry_Type giveGeometryType() const override {return EGT_line_1;} + void initializeFrom(InputRecord &ir) override; int computeNumberOfDofs() override { return this->dofs.giveSize(); } diff --git a/src/sm/Elements/nlstructuralelement.C b/src/sm/Elements/nlstructuralelement.C index 41c73b86b..10afe2e29 100644 --- a/src/sm/Elements/nlstructuralelement.C +++ b/src/sm/Elements/nlstructuralelement.C @@ -523,12 +523,10 @@ NLStructuralElement::checkConsistency() { if ( this->nlGeometry == 2 ) { OOFEM_ERROR("nlGeometry = 2 is not supported anymore. If access to F is needed, then the material \n should overload giveFirstPKStressVector which has F as input."); - return 0; } if ( this->nlGeometry != 0 && this->nlGeometry != 1 ) { OOFEM_ERROR("nlGeometry must be either 0 or 1 (%d not supported)", this->nlGeometry); - return 0; } else { return 1; } diff --git a/src/sm/Elements/quad1platesubsoil.h b/src/sm/Elements/quad1platesubsoil.h index 833d6045f..b33ba4e85 100644 --- a/src/sm/Elements/quad1platesubsoil.h +++ b/src/sm/Elements/quad1platesubsoil.h @@ -78,6 +78,8 @@ public SPRNodalRecoveryModelInterface int computeNumberOfDofs() override { return 4; } void giveDofManDofIDMask(int inode, IntArray &) const override; + Element_Geometry_Type giveGeometryType() const override {return EGT_quad_1;} + void computeMidPlaneNormal(FloatArray &answer, const GaussPoint *gp) override; diff --git a/src/sm/Elements/quad2platesubsoil.h b/src/sm/Elements/quad2platesubsoil.h index 067aaa605..0c96285b3 100644 --- a/src/sm/Elements/quad2platesubsoil.h +++ b/src/sm/Elements/quad2platesubsoil.h @@ -68,6 +68,8 @@ class Quad2PlateSubSoil : public Quad1PlateSubSoil // definition & identification const char *giveInputRecordName() const override { return _IFT_Quad2PlateSubSoil_Name; } const char *giveClassName() const override { return "Quad2PlateSubSoil"; } + Element_Geometry_Type giveGeometryType() const override {return EGT_quad_2;} + void initializeFrom(InputRecord &ir) override; int computeNumberOfDofs() override { return 8; } diff --git a/src/sm/Elements/structural2delement.C b/src/sm/Elements/structural2delement.C index e1a085052..42b6fdc44 100644 --- a/src/sm/Elements/structural2delement.C +++ b/src/sm/Elements/structural2delement.C @@ -75,7 +75,7 @@ Structural2DElement::postInitialize() int Structural2DElement::giveNumberOfNodes() const { - return this->giveInterpolation()->giveNumberOfNodes(); + return numberOfDofMans;//this->giveInterpolation()->giveNumberOfNodes(this->giveGeometryType()); } @@ -96,7 +96,7 @@ Structural2DElement::computeNumberOfDofs() ///@todo move one hiearchy up and generalize IntArray dofIdMask; this->giveDofManDofIDMask(-1, dofIdMask); // ok for standard elements - return this->giveInterpolation()->giveNumberOfNodes() * dofIdMask.giveSize(); + return this->giveInterpolation()->giveNumberOfNodes(this->giveGeometryType()) * dofIdMask.giveSize(); } diff --git a/src/sm/Elements/structural3delement.C b/src/sm/Elements/structural3delement.C index f820d5d57..66d5ce71e 100644 --- a/src/sm/Elements/structural3delement.C +++ b/src/sm/Elements/structural3delement.C @@ -305,7 +305,7 @@ Structural3DElement::computeNumberOfDofs() ///@todo move one hiearchy up and generalize IntArray dofIdMask; this->giveDofManDofIDMask(-1, dofIdMask); // ok for standard elements - return this->giveInterpolation()->giveNumberOfNodes() * dofIdMask.giveSize(); + return this->giveInterpolation()->giveNumberOfNodes(this->giveGeometryType()) * dofIdMask.giveSize(); } @@ -390,7 +390,6 @@ int Structural3DElement::computeLoadLSToLRotationMatrix(FloatMatrix &answer, int, GaussPoint *) { OOFEM_ERROR("surface local coordinate system not supported"); - return 1; } @@ -439,6 +438,5 @@ Structural3DElement::computeLoadLEToLRotationMatrix(FloatMatrix &answer, int iEd // ///@todo how should this be supported OOFEM_ERROR("egde local coordinate system not supported"); - return 1; } } // end namespace oofem diff --git a/src/sm/Elements/structuralelement.C b/src/sm/Elements/structuralelement.C index 2655ffeee..c9ab16564 100644 --- a/src/sm/Elements/structuralelement.C +++ b/src/sm/Elements/structuralelement.C @@ -179,7 +179,7 @@ StructuralElement :: computeSurfaceNMatrix(FloatMatrix &answer, int boundaryID, { FloatArray n_vec; this->giveInterpolation()->boundarySurfaceEvalN(n_vec, boundaryID, lcoords, FEIElementGeometryWrapper(this) ); - answer.beNMatrixOf(n_vec, this->giveInterpolation()->giveNsd() ); + answer.beNMatrixOf(n_vec, this->giveInterpolation()->giveNsd(this->giveGeometryType()) ); } @@ -252,7 +252,7 @@ StructuralElement :: computeEdgeNMatrix(FloatMatrix &answer, int boundaryID, con { FloatArray n_vec; this->giveInterpolation()->boundaryEdgeEvalN(n_vec, boundaryID, lcoords, FEIElementGeometryWrapper(this) ); - answer.beNMatrixOf(n_vec, this->giveInterpolation()->giveNsd() ); + answer.beNMatrixOf(n_vec, this->giveInterpolation()->giveNsd(this->giveGeometryType()) ); } @@ -330,7 +330,7 @@ StructuralElement :: giveNumberOfIPForMassMtrxIntegration() // \int_V N^T*N dV => (order of the approximation)*2 (constant density assumed) ///TODO this is without the jacobian and density int order = this->giveInterpolation()->giveInterpolationOrder(); - return iRule->getRequiredNumberOfIntegrationPoints(this->giveInterpolation()->giveIntegrationDomain(), 2 * order); + return iRule->getRequiredNumberOfIntegrationPoints(this->giveInterpolation()->giveIntegrationDomain(this->giveGeometryType()), 2 * order); } void @@ -478,7 +478,7 @@ StructuralElement :: computeResultingIPTemperatureAt(FloatArray &answer, TimeSte int n, nLoads; Load *load; FloatArray gCoords, temperature; - int nbc = domain->giveNumberOfBoundaryConditions(); + //int nbc = domain->giveNumberOfBoundaryConditions(); if ( this->computeGlobalCoordinates(gCoords, gp->giveNaturalCoordinates() ) == 0 ) { OOFEM_ERROR("computeGlobalCoordinates failed"); @@ -497,20 +497,17 @@ StructuralElement :: computeResultingIPTemperatureAt(FloatArray &answer, TimeSte // new approach using sets - - for ( int i = 1; i <= nbc; ++i ) { - GeneralBoundaryCondition *bc = domain->giveBc(i); - - if ( ( load = dynamic_cast< StructuralTemperatureLoad * >( bc ) ) ) { + // add exact end forces due to nonnodal loading applied indirectly (via sets) + BCTracker *bct = this->domain->giveBCTracker(); + BCTracker::entryListType bcList = bct->getElementRecords(this->number); + + for (BCTracker::entryListType::iterator it = bcList.begin(); it != bcList.end(); ++it) { + GeneralBoundaryCondition *bc = this->domain->giveBc((*it).bcNumber); + if ( ( load = dynamic_cast< StructuralTemperatureLoad * >( bc ) ) ) { if ( bc->giveSetNumber() && bc->isImposed(tStep) ) { if ( load->giveBCValType() == TemperatureBVT ) { - Set *set = domain->giveSet(bc->giveSetNumber() ); - const IntArray &elements = set->giveElementList(); - - if ( elements.contains(this->giveNumber() ) ) { - load->computeValueAt(temperature, tStep, gCoords, mode); - answer.add(temperature); - } + load->computeValueAt(temperature, tStep, gCoords, mode); + answer.add(temperature); } } } @@ -524,7 +521,7 @@ StructuralElement :: computeResultingIPEigenstrainAt(FloatArray &answer, TimeSte int n, nLoads; Load *load; FloatArray gCoords, eigenstrain; - int nbc = domain->giveNumberOfBoundaryConditions(); + //int nbc = domain->giveNumberOfBoundaryConditions(); if ( this->computeGlobalCoordinates(gCoords, gp->giveNaturalCoordinates() ) == 0 ) { OOFEM_ERROR("computeGlobalCoordinates failed"); @@ -545,20 +542,18 @@ StructuralElement :: computeResultingIPEigenstrainAt(FloatArray &answer, TimeSte } // new approach using sets - - for ( int i = 1; i <= nbc; ++i ) { - GeneralBoundaryCondition *bc = domain->giveBc(i); - + // add exact end forces due to nonnodal loading applied indirectly (via sets) + BCTracker *bct = this->domain->giveBCTracker(); + BCTracker::entryListType bcList = bct->getElementRecords(this->number); + + for (BCTracker::entryListType::iterator it = bcList.begin(); it != bcList.end(); ++it) { + GeneralBoundaryCondition *bc = this->domain->giveBc((*it).bcNumber); + if ( ( load = dynamic_cast< StructuralEigenstrainLoad * >( bc ) ) ) { if ( bc->giveSetNumber() && bc->isImposed(tStep) ) { if ( load->giveBCValType() == EigenstrainBVT ) { - Set *set = domain->giveSet(bc->giveSetNumber() ); - const IntArray &elements = set->giveElementList(); - - if ( elements.contains(this->giveNumber() ) ) { - load->computeValueAt(eigenstrain, tStep, gCoords, mode); - answer.add(eigenstrain); - } + load->computeValueAt(eigenstrain, tStep, gCoords, mode); + answer.add(eigenstrain); } } } diff --git a/src/sm/Elements/structuralelementevaluator.C b/src/sm/Elements/structuralelementevaluator.C index d7f61b471..44e17fdf1 100644 --- a/src/sm/Elements/structuralelementevaluator.C +++ b/src/sm/Elements/structuralelementevaluator.C @@ -89,7 +89,7 @@ int StructuralElementEvaluator :: giveIntegrationElementLocalCodeNumbers(IntArra elem->giveDofManDofIDMask(1, nodeDofIDMask); dofmandof = nodeDofIDMask.giveSize(); - nsd = elem->giveInterpolation()->giveNsd(); + nsd = elem->giveInterpolation()->giveNsd(elem->giveGeometryType()); // first evaluate nonzero basis function mask if ( elem->giveInterpolation()->hasSubPatchFormulation() ) { @@ -356,7 +356,7 @@ void StructuralElementEvaluator :: updateInternalState(TimeStep *tStep) // force updating strains & stresses for ( int i = 0; i < elem->giveNumberOfIntegrationRules(); i++ ) { -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( this->giveElement()->giveKnotSpanParallelMode(i) == Element_remote ) { continue; } @@ -390,7 +390,7 @@ void StructuralElementEvaluator :: computeStiffnessMatrix(FloatMatrix &answer, M numberOfIntegrationRules = elem->giveNumberOfIntegrationRules(); // loop over individual integration rules for ( int ir = 0; ir < numberOfIntegrationRules; ir++ ) { -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( this->giveElement()->giveKnotSpanParallelMode(ir) == Element_remote ) { continue; } diff --git a/src/sm/Elements/tet21ghostsolid.C b/src/sm/Elements/tet21ghostsolid.C index c462b93a9..aab2483d2 100644 --- a/src/sm/Elements/tet21ghostsolid.C +++ b/src/sm/Elements/tet21ghostsolid.C @@ -1211,11 +1211,11 @@ double tet21ghostsolid::computeVolumeAround(GaussPoint *gp) // Returns the portion of the receiver which is attached to gp. { - double determinant = fabs(this->interpolation.giveTransformationJacobian(gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(this) ) ); - double weight = gp->giveWeight(); + //double determinant = fabs(this->interpolation.giveTransformationJacobian(gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(this) ) ); + //double weight = gp->giveWeight(); return ( this->computeVolume() ); - return ( determinant * weight ); + //return ( determinant * weight ); } @@ -1398,10 +1398,10 @@ tet21ghostsolid::computeBoundarySurfaceLoadVector(FloatArray &answer, BoundaryLo FloatArray n_vec, f(18); FloatMatrix n, T; FloatArray force; - int nsd = fei->giveNsd(); + int nsd = fei->giveNsd(this->giveGeometryType()); f.zero(); - auto iRule = fei->giveBoundaryIntegrationRule(load->giveApproxOrder(), boundary); + auto iRule = fei->giveBoundaryIntegrationRule(load->giveApproxOrder(), boundary, this->giveGeometryType()); for ( auto &gp : * iRule ) { FloatArray lcoords = gp->giveNaturalCoordinates(); diff --git a/src/sm/Elements/tet21ghostsolid.h b/src/sm/Elements/tet21ghostsolid.h index be9e2fc52..99437e04d 100644 --- a/src/sm/Elements/tet21ghostsolid.h +++ b/src/sm/Elements/tet21ghostsolid.h @@ -66,6 +66,8 @@ class tet21ghostsolid : public NLStructuralElement, FEInterpolation *giveInterpolation() const override; FEInterpolation *giveInterpolation(DofIDItem id) const override; + Element_Geometry_Type giveGeometryType() const override {return EGT_tetra_2;} + void giveDofManDofIDMask(int inode, IntArray &answer) const override; const char *giveInputRecordName() const override { return _IFT_tet21ghostsolid_Name; } diff --git a/src/sm/Elements/tria1platesubsoil.h b/src/sm/Elements/tria1platesubsoil.h index 18d516c71..81f5a3a5c 100644 --- a/src/sm/Elements/tria1platesubsoil.h +++ b/src/sm/Elements/tria1platesubsoil.h @@ -78,6 +78,8 @@ public SPRNodalRecoveryModelInterface int computeNumberOfDofs() override { return 3; } void giveDofManDofIDMask(int inode, IntArray &) const override; + Element_Geometry_Type giveGeometryType() const override {return EGT_triangle_1;} + void computeMidPlaneNormal(FloatArray &answer, const GaussPoint *gp) override; diff --git a/src/sm/Elements/tria2platesubsoil.h b/src/sm/Elements/tria2platesubsoil.h index b153bc523..d40789eb0 100644 --- a/src/sm/Elements/tria2platesubsoil.h +++ b/src/sm/Elements/tria2platesubsoil.h @@ -67,6 +67,8 @@ class Tria2PlateSubSoil : public Tria1PlateSubSoil // definition & identification const char *giveInputRecordName() const override { return _IFT_Tria2PlateSubSoil_Name; } const char *giveClassName() const override { return "Tria2PlateSubSoil"; } + Element_Geometry_Type giveGeometryType() const override {return EGT_triangle_2;} + void initializeFrom(InputRecord &ir) override; int computeNumberOfDofs() override { return 6; } diff --git a/src/sm/Elements/trwarp.C b/src/sm/Elements/trwarp.C index d793f9f00..fc4a38af4 100644 --- a/src/sm/Elements/trwarp.C +++ b/src/sm/Elements/trwarp.C @@ -355,7 +355,7 @@ Tr_Warp :: ZZNodalRecoveryMI_computeNNMatrix(FloatArray &answer, InternalStateTy // The size of N mtrx is (nstresses, nnodes*nstreses) // Definition : sigmaVector = N * nodalSigmaVector // - double volume = 0.0; + //double volume = 0.0; FloatMatrix fullAnswer; FloatArray n; FEInterpolation *interpol = this->giveInterpolation(); @@ -368,14 +368,14 @@ Tr_Warp :: ZZNodalRecoveryMI_computeNNMatrix(FloatArray &answer, InternalStateTy int size = 3; //this->giveNumberOfDofManagers(); fullAnswer.resize(size, size); fullAnswer.zero(); - double pok = 0.0; + //double pok = 0.0; for ( auto &gp : *iRule ) { double dV = this->computeVolumeAround(gp); interpol->evalN( n, gp->giveNaturalCoordinates(), FEIElementGeometryWrapper(this) ); fullAnswer.plusDyadSymmUpper(n, dV); - pok += ( n.at(1) * dV ); ///@todo What is this? Completely unused. - volume += dV; + //pok += ( n.at(1) * dV ); ///@todo What is this? Completely unused. + //volume += dV; } fullAnswer.symmetrized(); diff --git a/src/sm/EngineeringModels/adaptnlinearstatic.C b/src/sm/EngineeringModels/adaptnlinearstatic.C index f709ddf76..3a7fc7e7b 100644 --- a/src/sm/EngineeringModels/adaptnlinearstatic.C +++ b/src/sm/EngineeringModels/adaptnlinearstatic.C @@ -55,7 +55,7 @@ #include "oofem_terminate.h" #include "unknownnumberingscheme.h" -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE #include "parallelcontext.h" #include "loadbalancer.h" #endif @@ -75,7 +75,7 @@ AdaptiveNonLinearStatic :: AdaptiveNonLinearStatic(int i, EngngModel *_master) : meshPackage = MPT_T3D; equilibrateMappedConfigurationFlag = 0; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE this->preMappingLoadBalancingFlag = false; #endif } @@ -121,7 +121,7 @@ AdaptiveNonLinearStatic :: solveYourselfAt(TimeStep *tStep) //this->terminate( this->giveCurrentStep() ); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( preMappingLoadBalancingFlag ) { this->balanceLoad( this->giveCurrentStep() ); } @@ -200,7 +200,6 @@ double AdaptiveNonLinearStatic :: giveUnknownComponent(ValueModeType mode, TimeS if ( tStep != this->giveCurrentStep() ) { OOFEM_ERROR("unknown time step encountered"); - return 0.; } if ( d->giveNumber() == 2 ) { @@ -226,7 +225,7 @@ double AdaptiveNonLinearStatic :: giveUnknownComponent(ValueModeType mode, TimeS return NonLinearStatic :: giveUnknownComponent(mode, tStep, d, dof); } - return 0.0; + // return 0.0; } @@ -519,7 +518,7 @@ AdaptiveNonLinearStatic :: adaptiveRemap(Domain *dNew) // this->forceEquationNumbering(); this->updateDomainLinks(); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( isParallel() ) { // set up communication patterns this->initializeCommMaps(true); @@ -937,11 +936,11 @@ AdaptiveNonLinearStatic :: giveTimeStepLoadLevel(int istep) OOFEM_ERROR("solution step out of range"); } - return 0.0; // to make compiler happy + // return 0.0; // to make compiler happy } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE LoadBalancer * AdaptiveNonLinearStatic :: giveLoadBalancer() { diff --git a/src/sm/EngineeringModels/adaptnlinearstatic.h b/src/sm/EngineeringModels/adaptnlinearstatic.h index 28459d697..36c3375a4 100644 --- a/src/sm/EngineeringModels/adaptnlinearstatic.h +++ b/src/sm/EngineeringModels/adaptnlinearstatic.h @@ -136,7 +136,7 @@ class AdaptiveNonLinearStatic : public NonLinearStatic const char *giveClassName() const override { return "AdaptiveNonLinearStatic"; } const char *giveInputRecordName() const override { return _IFT_AdaptiveNonLinearStatic_Name; } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE LoadBalancer *giveLoadBalancer() override; LoadBalancerMonitor *giveLoadBalancerMonitor() override; #endif diff --git a/src/sm/EngineeringModels/deidynamic.C b/src/sm/EngineeringModels/deidynamic.C index 7e7558eb7..82a66fb21 100644 --- a/src/sm/EngineeringModels/deidynamic.C +++ b/src/sm/EngineeringModels/deidynamic.C @@ -81,7 +81,6 @@ double DEIDynamic :: giveUnknownComponent(ValueModeType mode, TimeStep *tStep, D if ( tStep != this->giveCurrentStep() ) { OOFEM_ERROR("unknown time step encountered"); - return 0.; } switch ( mode ) { @@ -98,7 +97,7 @@ double DEIDynamic :: giveUnknownComponent(ValueModeType mode, TimeStep *tStep, D OOFEM_ERROR("Unknown is of undefined ValueModeType for this problem"); } - return 0.0; + // return 0.0; } diff --git a/src/sm/EngineeringModels/diidynamic.C b/src/sm/EngineeringModels/diidynamic.C index 3659439e8..64afea7e5 100644 --- a/src/sm/EngineeringModels/diidynamic.C +++ b/src/sm/EngineeringModels/diidynamic.C @@ -142,7 +142,6 @@ double DIIDynamic :: giveUnknownComponent(ValueModeType mode, TimeStep *tStep, D if ( tStep != this->giveCurrentStep() ) { OOFEM_ERROR("unknown time step encountered"); - return 0.; } switch ( mode ) { @@ -159,7 +158,7 @@ double DIIDynamic :: giveUnknownComponent(ValueModeType mode, TimeStep *tStep, D OOFEM_ERROR("Unknown is of undefined ValueModeType for this problem"); } - return 0.0; + // return 0.0; } diff --git a/src/sm/EngineeringModels/eigenvaluedynamic.C b/src/sm/EngineeringModels/eigenvaluedynamic.C index 9f141ebbd..8a8158381 100644 --- a/src/sm/EngineeringModels/eigenvaluedynamic.C +++ b/src/sm/EngineeringModels/eigenvaluedynamic.C @@ -32,6 +32,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ +#include #include "sm/EngineeringModels/eigenvaluedynamic.h" #include "timestep.h" #include "floatmatrix.h" diff --git a/src/sm/EngineeringModels/eigenvaluedynamic.h b/src/sm/EngineeringModels/eigenvaluedynamic.h index 0d85e127f..296a7b292 100644 --- a/src/sm/EngineeringModels/eigenvaluedynamic.h +++ b/src/sm/EngineeringModels/eigenvaluedynamic.h @@ -69,7 +69,7 @@ class EigenValueDynamic : public EngngModel std :: unique_ptr< EigenVectorPrimaryField > field; FloatArray eigVal; int activeVector; - int restoreFlag; + // int restoreFlag; SparseMtrxType sparseMtrxType; int numberOfRequiredEigenValues; /// Relative tolerance. diff --git a/src/sm/EngineeringModels/freewarping.C b/src/sm/EngineeringModels/freewarping.C index 1ac1937bb..f6d1cb6cb 100644 --- a/src/sm/EngineeringModels/freewarping.C +++ b/src/sm/EngineeringModels/freewarping.C @@ -52,7 +52,7 @@ //#define THROW_CIOERR(e) throw ContextIOERR(e, __FILE__, __LINE__); // km??? -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE #include "problemcomm.h" #include "communicator.h" #endif @@ -105,7 +105,7 @@ FreeWarping :: initializeFrom(InputRecord &ir) IR_GIVE_OPTIONAL_FIELD(ir, val, _IFT_EngngModel_smtype); sparseMtrxType = ( SparseMtrxType ) val; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( isParallel() ) { commBuff = new CommunicatorBuff( this->giveNumberOfProcesses() ); communicator = new NodeCommunicator(this, commBuff, this->giveRank(), @@ -196,7 +196,6 @@ double FreeWarping :: giveUnknownComponent(ValueModeType mode, TimeStep *tStep, if ( tStep != this->giveCurrentStep() ) { OOFEM_ERROR("unknown time step encountered"); - return 0.; } switch ( mode ) { @@ -212,7 +211,7 @@ double FreeWarping :: giveUnknownComponent(ValueModeType mode, TimeStep *tStep, OOFEM_ERROR("Unknown is of undefined type for this problem"); } - return 0.; + // return 0.; } diff --git a/src/sm/EngineeringModels/incrementallinearstatic.C b/src/sm/EngineeringModels/incrementallinearstatic.C index 3bf695986..aec99521d 100644 --- a/src/sm/EngineeringModels/incrementallinearstatic.C +++ b/src/sm/EngineeringModels/incrementallinearstatic.C @@ -33,6 +33,7 @@ */ #include "sm/EngineeringModels/incrementallinearstatic.h" +#include "oofemcfg.h" #include "timestep.h" #include "dof.h" #include "domain.h" @@ -142,7 +143,6 @@ double IncrementalLinearStatic :: giveDiscreteTime(int iStep) } OOFEM_ERROR("invalid iStep"); - return 0.0; } @@ -327,7 +327,7 @@ double IncrementalLinearStatic :: giveUnknownComponent(ValueModeType mode, TimeS OOFEM_ERROR("Only the mode requiresUnknownsDictionaryUpdate() is supported"); } - return 0.; + // return 0.; } diff --git a/src/sm/EngineeringModels/linearstability.C b/src/sm/EngineeringModels/linearstability.C index 6a18a20ed..77d51fadc 100644 --- a/src/sm/EngineeringModels/linearstability.C +++ b/src/sm/EngineeringModels/linearstability.C @@ -35,6 +35,7 @@ // please activate or de-activate next line //#define LIN_STAB_COMPATIBILITY_MODE +#include "oofemcfg.h" #include "sm/EngineeringModels/linearstability.h" #include "timestep.h" #include "element.h" diff --git a/src/sm/EngineeringModels/linearstatic.C b/src/sm/EngineeringModels/linearstatic.C index deb2935aa..08821fe29 100644 --- a/src/sm/EngineeringModels/linearstatic.C +++ b/src/sm/EngineeringModels/linearstatic.C @@ -47,7 +47,7 @@ #include "classfactory.h" #include "unknownnumberingscheme.h" -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE #include "problemcomm.h" #include "communicator.h" #endif @@ -100,7 +100,7 @@ LinearStatic :: initializeFrom(InputRecord &ir) IR_GIVE_OPTIONAL_FIELD(ir, val, _IFT_EngngModel_smtype); sparseMtrxType = ( SparseMtrxType ) val; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( isParallel() ) { commBuff = new CommunicatorBuff( this->giveNumberOfProcesses() ); communicator = new NodeCommunicator(this, commBuff, this->giveRank(), @@ -124,7 +124,6 @@ double LinearStatic :: giveUnknownComponent(ValueModeType mode, TimeStep *tStep, if ( tStep != this->giveCurrentStep() ) { OOFEM_ERROR("unknown time step encountered"); - return 0.; } switch ( mode ) { diff --git a/src/sm/EngineeringModels/nldeidynamic.C b/src/sm/EngineeringModels/nldeidynamic.C index f604293b7..56b402b30 100644 --- a/src/sm/EngineeringModels/nldeidynamic.C +++ b/src/sm/EngineeringModels/nldeidynamic.C @@ -46,7 +46,7 @@ #include "classfactory.h" #include "unknownnumberingscheme.h" -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE #include "problemcomm.h" #include "processcomm.h" #endif @@ -96,7 +96,7 @@ NlDEIDynamic :: initializeFrom(InputRecord &ir) IR_GIVE_FIELD(ir, pyEstimate, _IFT_NlDEIDynamic_py); } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE commBuff = new CommunicatorBuff( this->giveNumberOfProcesses() ); communicator = new NodeCommunicator(this, commBuff, this->giveRank(), this->giveNumberOfProcesses()); @@ -124,7 +124,6 @@ double NlDEIDynamic :: giveUnknownComponent(ValueModeType mode, TimeStep *tStep, if ( tStep != this->giveCurrentStep() ) { OOFEM_ERROR("unknown time step encountered"); - return 0.; } switch ( mode ) { @@ -144,7 +143,7 @@ double NlDEIDynamic :: giveUnknownComponent(ValueModeType mode, TimeStep *tStep, OOFEM_ERROR("Unknown is of undefined type for this problem"); } - return 0.; + // return 0.; } @@ -209,7 +208,7 @@ void NlDEIDynamic :: solveYourselfAt(TimeStep *tStep) this->computeLoadVector(loadRefVector, VM_Total, tStep); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE // Compute the processor part of load vector norm pMp this->pMp = 0.0; double my_pMp = 0.0; @@ -297,7 +296,7 @@ void NlDEIDynamic :: solveYourselfAt(TimeStep *tStep) if ( deltaT > maxDt ) { //Scale number of steps based on reduced time step newDeltaT = maxDt; - newNumberOfSteps = floor(numberOfSteps*deltaT/newDeltaT); + newNumberOfSteps = (int) floor(numberOfSteps*deltaT/newDeltaT); this->giveMetaStep(1)->setNumberOfSteps(newNumberOfSteps); this->deltaT = newDeltaT; tStep->setTimeIncrement(deltaT); @@ -342,7 +341,7 @@ void NlDEIDynamic :: solveYourselfAt(TimeStep *tStep) // compute load factor pt = 0.0; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE double my_pt = 0.0; for ( auto &dman : domain->giveDofManagers() ) { dofManagerParallelMode dofmanmode = dman->giveParallelMode(); @@ -386,7 +385,7 @@ void NlDEIDynamic :: solveYourselfAt(TimeStep *tStep) // Compute relative error. double err = 0.0; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE double my_err = 0.0; for ( auto &dman : domain->giveDofManagers() ) { @@ -635,7 +634,7 @@ NlDEIDynamic :: computeMassMtrx(FloatArray &massMatrix, double &maxOm, TimeStep this->updateSharedDofManagers(massMatrix, EModelDefaultEquationNumbering(), MassExchangeTag); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE // Determine maxOm over all processes. #ifdef __USE_MPI double globalMaxOm; diff --git a/src/sm/EngineeringModels/nlineardynamic.C b/src/sm/EngineeringModels/nlineardynamic.C index cdafed8e3..4d7249afa 100644 --- a/src/sm/EngineeringModels/nlineardynamic.C +++ b/src/sm/EngineeringModels/nlineardynamic.C @@ -57,7 +57,7 @@ using namespace std; #include "unknownnumberingscheme.h" #include "assemblercallback.h" -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE #include "loadbalancer.h" #include "problemcomm.h" #include "processcomm.h" @@ -162,7 +162,7 @@ NonLinearDynamic :: initializeFrom(InputRecord &ir) MANRMSteps = 0; IR_GIVE_OPTIONAL_FIELD(ir, MANRMSteps, _IFT_NRSolver_manrmsteps); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( isParallel() ) { commBuff = new CommunicatorBuff(this->giveNumberOfProcesses(), CBT_static); communicator = new NodeCommunicator(this, commBuff, this->giveRank(), @@ -189,7 +189,6 @@ double NonLinearDynamic :: giveUnknownComponent(ValueModeType mode, TimeStep *tS if ( tStep != this->giveCurrentStep() ) { OOFEM_ERROR("unknown time step encountered"); - return 0.; } switch ( mode ) { @@ -208,8 +207,6 @@ double NonLinearDynamic :: giveUnknownComponent(ValueModeType mode, TimeStep *tS default: OOFEM_ERROR("Unknown is of undefined ValueModeType for this problem"); } - - return 0.0; } @@ -786,7 +783,7 @@ NonLinearDynamic :: updateDomainLinks() EngngModel :: updateDomainLinks(); this->giveNumericalMethod( this->giveCurrentMetaStep() )->setDomain( this->giveDomain(1) ); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( this->giveLoadBalancer() ) { this->giveLoadBalancer()->setDomain( this->giveDomain(1) ); } @@ -937,7 +934,7 @@ NonLinearDynamic :: estimateMaxPackSize(IntArray &commMap, DataStream &buff, int } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE LoadBalancer * NonLinearDynamic :: giveLoadBalancer() { diff --git a/src/sm/EngineeringModels/nlineardynamic.h b/src/sm/EngineeringModels/nlineardynamic.h index cf44071bd..bc2560a30 100644 --- a/src/sm/EngineeringModels/nlineardynamic.h +++ b/src/sm/EngineeringModels/nlineardynamic.h @@ -155,7 +155,7 @@ class NonLinearDynamic : public StructuralEngngModel #endif int estimateMaxPackSize(IntArray &commMap, DataStream &buff, int packUnpackType) override; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE LoadBalancer *giveLoadBalancer() override; LoadBalancerMonitor *giveLoadBalancerMonitor() override; #endif diff --git a/src/sm/EngineeringModels/nlinearstatic.C b/src/sm/EngineeringModels/nlinearstatic.C index f7cb5e5ff..e00014dc8 100644 --- a/src/sm/EngineeringModels/nlinearstatic.C +++ b/src/sm/EngineeringModels/nlinearstatic.C @@ -55,7 +55,7 @@ #include "unknownnumberingscheme.h" #include "function.h" -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE #include "problemcomm.h" #include "communicator.h" #include "loadbalancer.h" @@ -83,6 +83,9 @@ NonLinearStatic :: NonLinearStatic(int i, EngngModel *_master) : LinearStatic(i, refLoadInputMode = SparseNonLinearSystemNM :: rlm_total; nMethod = NULL; initialGuessType = IG_None; + deltaT = 1.0; + dtFunction = 0; + currentIterations = 0; } @@ -200,7 +203,7 @@ NonLinearStatic :: initializeFrom(InputRecord &ir) updateElasticStiffnessFlag = true; } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( isParallel() ) { //commBuff = new CommunicatorBuff (this->giveNumberOfProcesses(), CBT_dynamic); commBuff = new CommunicatorBuff(this->giveNumberOfProcesses(), CBT_static); @@ -223,7 +226,6 @@ double NonLinearStatic :: giveUnknownComponent(ValueModeType mode, TimeStep *tSt { if ( tStep != this->giveCurrentStep() ) { OOFEM_ERROR("unknown time step encountered"); - return 0.; } int eq = dof->__giveEquationNumber(); @@ -272,7 +274,6 @@ double NonLinearStatic :: giveUnknownComponent(ValueModeType mode, TimeStep *tSt } else { OOFEM_ERROR("Unknown is of undefined ValueModeType for this problem"); } - return 0.0; } TimeStep *NonLinearStatic :: giveSolutionStepWhenIcApply(bool force) @@ -774,7 +775,7 @@ NonLinearStatic :: updateDomainLinks() LinearStatic :: updateDomainLinks(); this->giveNumericalMethod( this->giveCurrentMetaStep() )->setDomain( this->giveDomain(1) ); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( this->giveLoadBalancer() ) { this->giveLoadBalancer()->setDomain( this->giveDomain(1) ); } @@ -788,8 +789,8 @@ NonLinearStatic :: assemble(SparseMtrx &answer, TimeStep *tStep, const MatrixAss const UnknownNumberingScheme &s, Domain *domain) { #ifdef TIME_REPORT - Timer timer; - timer.startTimer(); + Timer _timer; + _timer.startTimer(); #endif LinearStatic :: assemble(answer, tStep, ma, s, domain); @@ -805,8 +806,8 @@ NonLinearStatic :: assemble(SparseMtrx &answer, TimeStep *tStep, const MatrixAss } #ifdef TIME_REPORT - timer.stopTimer(); - OOFEM_LOG_DEBUG( "NonLinearStatic: User time consumed by assembly: %.2fs\n", timer.getUtime() ); + _timer.stopTimer(); + OOFEM_LOG_DEBUG( "NonLinearStatic: User time consumed by assembly: %.2fs\n", _timer.getUtime() ); #endif } @@ -915,7 +916,7 @@ NonLinearStatic :: estimateMaxPackSize(IntArray &commMap, DataStream &buff, int } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE LoadBalancer * NonLinearStatic :: giveLoadBalancer() { diff --git a/src/sm/EngineeringModels/nlinearstatic.h b/src/sm/EngineeringModels/nlinearstatic.h index 25e538161..cc2848796 100644 --- a/src/sm/EngineeringModels/nlinearstatic.h +++ b/src/sm/EngineeringModels/nlinearstatic.h @@ -180,7 +180,7 @@ class NonLinearStatic : public LinearStatic #endif int estimateMaxPackSize(IntArray &commMap, DataStream &buff, int packUnpackType) override; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE LoadBalancer *giveLoadBalancer() override; LoadBalancerMonitor *giveLoadBalancerMonitor() override; diff --git a/src/sm/EngineeringModels/pdelta.C b/src/sm/EngineeringModels/pdelta.C index 76c23c26b..7c84a89c5 100644 --- a/src/sm/EngineeringModels/pdelta.C +++ b/src/sm/EngineeringModels/pdelta.C @@ -47,7 +47,7 @@ #include "classfactory.h" #include "unknownnumberingscheme.h" -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE #include "problemcomm.h" #include "communicator.h" #endif diff --git a/src/sm/EngineeringModels/qclinearstatic.C b/src/sm/EngineeringModels/qclinearstatic.C index 60890ebff..7b0f66526 100644 --- a/src/sm/EngineeringModels/qclinearstatic.C +++ b/src/sm/EngineeringModels/qclinearstatic.C @@ -63,7 +63,7 @@ #include "t3d.h" #endif -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE #include "problemcomm.h" #include "communicator.h" #endif @@ -169,7 +169,7 @@ QClinearStatic :: initializeFrom(InputRecord &ir) generateInterpolationElements = 0; } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( isParallel() ) { commBuff = new CommunicatorBuff( this->giveNumberOfProcesses() ); communicator = new NodeCommunicator( this, commBuff, this->giveRank(), @@ -280,7 +280,7 @@ void QClinearStatic :: solveYourselfAt(TimeStep *tStep) { // initialize node eq numbering (for actived nodes only) if ( !qcEquationNumbering.giveIsInitializedFlag() ) { - qcEquationNumbering.init(this->giveDomain(1), activatedNodeList, tStep); + qcEquationNumbering.init2(this->giveDomain(1), activatedNodeList, tStep); } LinearStatic :: solveYourselfAt(tStep); } @@ -535,9 +535,9 @@ QClinearStatic :: transformMeshToParticles(Domain *d, std :: vector< FloatArray // number of particles (nodes in domain) //int nop = this->giveDomain(1)->giveNumberOfDofManagers() ; // TO DO we assume that all DofManagers all nodes (particles) // number of (mesh) nodes - int nomn = nodeCoords.size(); + int nomn = (int) nodeCoords.size(); // number of (mesh) element - int nome = meshNodes.size(); + int nome = (int) meshNodes.size(); //newMeshNodes=meshNodes; std :: vector< IntArray >newMeshNodes; diff --git a/src/sm/EngineeringModels/staticstructural.C b/src/sm/EngineeringModels/staticstructural.C index fd3806858..34a424ad6 100644 --- a/src/sm/EngineeringModels/staticstructural.C +++ b/src/sm/EngineeringModels/staticstructural.C @@ -55,7 +55,7 @@ #include "classfactory.h" #include "assemblercallback.h" -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE #include "problemcomm.h" #include "communicator.h" #endif @@ -132,7 +132,7 @@ StaticStructural :: initializeFrom(InputRecord &ir) mRecomputeStepAfterPropagation = ir.hasField(_IFT_StaticStructural_recomputeaftercrackpropagation); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE ///@todo Where is the best place to create these? if ( isParallel() ) { delete communicator; @@ -227,7 +227,7 @@ double StaticStructural :: giveEndOfTimeOfInterest() void StaticStructural :: solveYourself() { ///@todo Generalize this to engngmodel? -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( this->isParallel() ) { #ifdef __VERBOSE_PARALLEL // force equation numbering before setting up comm maps diff --git a/src/sm/ErrorEstimators/directerrorindicatorrc.C b/src/sm/ErrorEstimators/directerrorindicatorrc.C index 0ac644b1d..0a4377d0c 100644 --- a/src/sm/ErrorEstimators/directerrorindicatorrc.C +++ b/src/sm/ErrorEstimators/directerrorindicatorrc.C @@ -42,7 +42,7 @@ #include "mathfem.h" #include "timestep.h" -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE #include "problemcomm.h" #endif @@ -50,7 +50,7 @@ namespace oofem { DirectErrorIndicatorRC :: DirectErrorIndicatorRC(int n, ErrorEstimator *e) : RemeshingCriteria(n, e) { stateCounter = -1; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE dofManDensityExchangeFlag = true; #endif } @@ -70,7 +70,7 @@ DirectErrorIndicatorRC :: giveNodeChar(int inode, TimeStep *tStep, double &indic double DirectErrorIndicatorRC :: giveDofManDensity(int num) { -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE Domain *d = this->giveDomain(); if ( d->giveDofManager(num)->isShared() ) { return this->sharedDofManDensities [ num ]; @@ -114,7 +114,7 @@ DirectErrorIndicatorRC :: giveLocalDofManDensity(int num) double DirectErrorIndicatorRC :: giveDofManIndicator(int num, TimeStep *tStep) { -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE Domain *d = this->giveDomain(); if ( d->giveDofManager(num)->isShared() ) { return this->sharedDofManIndicatorVals [ num ]; @@ -167,7 +167,7 @@ DirectErrorIndicatorRC :: estimateMeshDensities(TimeStep *tStep) return 1; } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE if ( initCommMap ) { communicator->setUpCommunicationMaps(d->giveEngngModel(), true, true); OOFEM_LOG_INFO("DirectErrorIndicatorRC :: estimateMeshDensities: initialized comm maps\n"); @@ -208,7 +208,7 @@ DirectErrorIndicatorRC :: estimateMeshDensities(TimeStep *tStep) } } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE // exchange strategies between nodes to ensure consistency int myStrategy = this->currStrategy, globalStrategy; MPI_Allreduce(& myStrategy, & globalStrategy, 1, MPI_INT, MPI_MAX, MPI_COMM_WORLD); @@ -247,7 +247,7 @@ DirectErrorIndicatorRC :: initializeFrom(InputRecord &ir) remeshingDensityRatioToggle = 0.80; IR_GIVE_OPTIONAL_FIELD(ir, remeshingDensityRatioToggle, _IFT_DirectErrorIndicatorRC_remeshingdensityratio); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE EngngModel *emodel = domain->giveEngngModel(); commBuff = new CommunicatorBuff(emodel->giveNumberOfProcesses(), CBT_dynamic); communicator = new NodeCommunicator(emodel, commBuff, emodel->giveRank(), @@ -266,7 +266,7 @@ void DirectErrorIndicatorRC :: reinitialize() { stateCounter = -1; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE dofManDensityExchangeFlag = true; initCommMap = true; #endif @@ -277,14 +277,14 @@ void DirectErrorIndicatorRC :: setDomain(Domain *d) { RemeshingCriteria :: setDomain(d); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE dofManDensityExchangeFlag = true; initCommMap = true; #endif } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE void DirectErrorIndicatorRC :: exchangeDofManDensities() { diff --git a/src/sm/ErrorEstimators/directerrorindicatorrc.h b/src/sm/ErrorEstimators/directerrorindicatorrc.h index dd85af563..56f94d95d 100644 --- a/src/sm/ErrorEstimators/directerrorindicatorrc.h +++ b/src/sm/ErrorEstimators/directerrorindicatorrc.h @@ -84,7 +84,7 @@ class DirectErrorIndicatorRC : public RemeshingCriteria /// Actual values (densities) state counter. StateCounterType stateCounter; RemeshingStrategy currStrategy; -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE std :: map< int, double >sharedDofManDensities; std :: map< int, double >sharedDofManIndicatorVals; bool dofManDensityExchangeFlag; @@ -124,7 +124,7 @@ class DirectErrorIndicatorRC : public RemeshingCriteria */ double giveDofManIndicator(int num, TimeStep *tStep); double giveLocalDofManIndicator(int num, TimeStep *tStep); -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE void exchangeDofManDensities(); int packSharedDofManLocalDensities(ProcessCommunicator &processComm); int unpackSharedDofManLocalDensities(ProcessCommunicator &processComm); diff --git a/src/sm/ErrorEstimators/huertaerrorestimator.C b/src/sm/ErrorEstimators/huertaerrorestimator.C index bc117686d..637632a31 100644 --- a/src/sm/ErrorEstimators/huertaerrorestimator.C +++ b/src/sm/ErrorEstimators/huertaerrorestimator.C @@ -188,7 +188,6 @@ HuertaErrorEstimator :: estimateError(EE_ErrorMode err_mode, TimeStep *tStep) this->mode = HEE_nlinear; } else { OOFEM_ERROR("Unsupported analysis type"); - this->mode = HEE_linear; } // check if each node has default number of dofs @@ -274,7 +273,7 @@ HuertaErrorEstimator :: estimateError(EE_ErrorMode err_mode, TimeStep *tStep) this->solveRefinedElementProblem(ielem, localNodeIdArray, globalNodeIdArray, tStep); } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE #ifdef __USE_MPI double buffer_out [ 4 ], buffer_in [ 4 ]; @@ -345,7 +344,7 @@ HuertaErrorEstimator :: estimateError(EE_ErrorMode err_mode, TimeStep *tStep) globalWENorm += eerror * eerror * iratio; } -#ifdef __PARALLEL_MODE +#ifdef __MPI_PARALLEL_MODE #ifdef __USE_MPI double myGlobalWENorm = globalWENorm; MPI_Allreduce(& myGlobalWENorm, & globalWENorm, 1, MPI_DOUBLE, MPI_SUM, MPI_COMM_WORLD); @@ -466,7 +465,7 @@ HuertaErrorEstimator :: estimateError(EE_ErrorMode err_mode, TimeStep *tStep) #ifdef EXACT_ERROR if ( exactFlag == true ) { - #ifdef __PARALLEL_MODE + #ifdef __MPI_PARALLEL_MODE #ifdef __USE_MPI buffer_out [ 0 ] = exactENorm; buffer_out [ 1 ] = coarseUNorm; @@ -749,7 +748,7 @@ HuertaRemeshingCriteria :: estimateMeshDensities(TimeStep *tStep) skipped = this->ee->giveNumberOfSkippedElements(); -#ifndef __PARALLEL_MODE +#ifndef __MPI_PARALLEL_MODE globalNelems = nelem; #endif diff --git a/src/sm/Loads/foreigntempfieldload.C b/src/sm/Loads/externaltempfieldload.C similarity index 53% rename from src/sm/Loads/foreigntempfieldload.C rename to src/sm/Loads/externaltempfieldload.C index 359b11aac..180887057 100644 --- a/src/sm/Loads/foreigntempfieldload.C +++ b/src/sm/Loads/externaltempfieldload.C @@ -10,7 +10,7 @@ * * OOFEM : Object Oriented Finite Element Code * - * Copyright (C) 1993 - 2013 Borek Patzak + * Copyright (C) 1993 - 2024 Borek Patzak * * * @@ -32,32 +32,54 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "foreigntempfieldload.h" +#include "externaltempfieldload.h" #include "timestep.h" #include "classfactory.h" #include "field.h" +#include "vtkhdf5reader.h" +#include "unstructuredgridfield.h" namespace oofem { -REGISTER_BoundaryCondition(ForeignTemperatureFieldLoad); +REGISTER_BoundaryCondition(ExternalTemperatureFieldLoad); void -ForeignTemperatureFieldLoad :: computeValueAt(FloatArray &answer, TimeStep *tStep, const FloatArray &coords, ValueModeType mode) +ExternalTemperatureFieldLoad :: computeValueAt(FloatArray &answer, TimeStep *tStep, const FloatArray &coords, ValueModeType mode) // Returns the value of the receiver at time and given position respecting the mode. { if(!foreignField){ - OOFEM_ERROR("ForeignTemperatureFieldLoad: foreignField must be assigned from python (is NULL).") } + OOFEM_ERROR("ExternalTemperatureFieldLoad: foreignField must be assigned from python (is NULL).") } if ( ( mode != VM_Incremental ) && ( mode != VM_Total ) ) { OOFEM_ERROR("unknown mode (%s)", __ValueModeTypeToString(mode) ); } + if (this->vtkhdffielddefined) + { + if (this->readerStateCounter != tStep->giveSolutionStateCounter()) + { + this->readerStateCounter = tStep->giveSolutionStateCounter(); + this->vtkReader.readMesh(*((UnstructuredGridField*)foreignField.get()), tStep); + this->vtkReader.readField(*((UnstructuredGridField*)foreignField.get()), tStep, vtkhdfFieldname); + } + } + if(foreignField->evaluateAt(answer, coords, mode, tStep)){ - OOFEM_ERROR("ForeignTemperatureFieldLoad::foreignField.evaluateAt(...) failed."); + OOFEM_ERROR("ExternalTemperatureFieldLoad::foreignField.evaluateAt(...) failed."); } } void -ForeignTemperatureFieldLoad :: initializeFrom(InputRecord &ir) +ExternalTemperatureFieldLoad :: initializeFrom(InputRecord &ir) { + set = 0; + IR_GIVE_OPTIONAL_FIELD(ir, set, _IFT_GeneralBoundaryCondition_set); + + IR_GIVE_OPTIONAL_FIELD(ir, vtkhdfFilename, _IFT_ExternalTemperatureFieldLoad_VTKHDF5FileName); // Macro - see internalstatetype.h + IR_GIVE_OPTIONAL_FIELD(ir, vtkhdfFieldname, _IFT_ExternalTemperatureFieldLoad_VTKHDF5FieldName); // Macro - see internalstatetype.h + foreignField = std::make_shared(0,0,0.); + this->vtkReader.initialize(vtkhdfFilename); + vtkhdffielddefined = true; + readerStateCounter = 0; } + } // end namespace oofem diff --git a/src/sm/Loads/foreigntempfieldload.h b/src/sm/Loads/externaltempfieldload.h similarity index 74% rename from src/sm/Loads/foreigntempfieldload.h rename to src/sm/Loads/externaltempfieldload.h index 65d7cb95e..c476a2620 100644 --- a/src/sm/Loads/foreigntempfieldload.h +++ b/src/sm/Loads/externaltempfieldload.h @@ -32,22 +32,25 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef foreigntempfield_h -#define foreigntempfield_h +#ifndef externaltempfield_h +#define externaltempfield_h #include // std::shared_ptr #include "structtemperatureload.h" +#include "vtkhdf5reader.h" -///@name Input fields for ForeignTemperatureFieldLoad +///@name Input fields for ExternalTemperatureFieldLoad //@{ -#define _IFT_ForeignTemperatureFieldLoad_Name "foreigntempfieldload" +#define _IFT_ExternalTemperatureFieldLoad_Name "externaltempfieldload" +#define _IFT_ExternalTemperatureFieldLoad_VTKHDF5FileName "vtkhdf5filename" +#define _IFT_ExternalTemperatureFieldLoad_VTKHDF5FieldName "vtkhdf5fieldname" //@} namespace oofem { class Field; /** - * Class representing foreign temperature field, which asks a field object to return + * Class representing foreign, external temperature field, which asks a field object to return * temperature at given point. * * The load time function is not used here, the field has to be updated by the user @@ -57,8 +60,14 @@ class Field; * is only one mesh defined), it is typically assigned using Python bindings. * */ -class ForeignTemperatureFieldLoad : public StructuralTemperatureLoad +class ExternalTemperatureFieldLoad : public StructuralTemperatureLoad { +protected: + VTKHDF5Reader vtkReader; + StateCounterType readerStateCounter; + bool vtkhdffielddefined = false; + std::string vtkhdfFilename; + std::string vtkhdfFieldname; public: // make public so that it can be simply set from python std::shared_ptr foreignField; @@ -67,9 +76,9 @@ class ForeignTemperatureFieldLoad : public StructuralTemperatureLoad * @param n Load time function number * @param d Domain to which new object will belongs. */ - ForeignTemperatureFieldLoad(int n, Domain * d) : StructuralTemperatureLoad(n, d) { } + ExternalTemperatureFieldLoad(int n, Domain * d) : StructuralTemperatureLoad(n, d) { } /// Destructor - virtual ~ForeignTemperatureFieldLoad() { } + virtual ~ExternalTemperatureFieldLoad() { } /** * Computes components values of temperature field at given point (coordinates given in Global c.s.). @@ -81,10 +90,10 @@ class ForeignTemperatureFieldLoad : public StructuralTemperatureLoad */ void computeValueAt(FloatArray &answer, TimeStep *tStep, const FloatArray &coords, ValueModeType mode) override; - const char *giveInputRecordName() const override { return _IFT_ForeignTemperatureFieldLoad_Name; } - const char *giveClassName() const override { return "ForeignTemperatureFieldLoad"; } + const char *giveInputRecordName() const override { return _IFT_ExternalTemperatureFieldLoad_Name; } + const char *giveClassName() const override { return "ExternalTemperatureFieldLoad"; } void initializeFrom(InputRecord &ir) override; }; } // end namespace oofem -#endif // foreigntempfield_h +#endif // externaltempfield_h diff --git a/src/sm/Materials/BoneMaterials/trabbonegrad3d.C b/src/sm/Materials/BoneMaterials/trabbonegrad3d.C index 2e50e27b6..e164930a1 100644 --- a/src/sm/Materials/BoneMaterials/trabbonegrad3d.C +++ b/src/sm/Materials/BoneMaterials/trabbonegrad3d.C @@ -56,7 +56,7 @@ TrabBoneGrad3D :: hasMaterialModeCapability(MaterialMode mode) const } void TrabBoneGrad3D :: giveStiffnessMatrix(FloatMatrix &answer, - MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) + MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) const // // Returns characteristic material stiffness matrix of the receiver // diff --git a/src/sm/Materials/BoneMaterials/trabbonegrad3d.h b/src/sm/Materials/BoneMaterials/trabbonegrad3d.h index 7efb57d40..e01edf60b 100644 --- a/src/sm/Materials/BoneMaterials/trabbonegrad3d.h +++ b/src/sm/Materials/BoneMaterials/trabbonegrad3d.h @@ -103,7 +103,7 @@ class TrabBoneGrad3D : public TrabBone3D, GradientDamageMaterialExtensionInterfa void giveGradientDamageStiffnessMatrix_ud(FloatMatrix &answer, MatResponseMode mode, GaussPoint *gp, TimeStep *tStep) override; void giveGradientDamageStiffnessMatrix_dd_BB(FloatMatrix &answer, MatResponseMode mode, GaussPoint *gp, TimeStep *tStep) override; - void giveStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) override; + void giveStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) const override; FloatMatrixF<6,6> give3dMaterialStiffnessMatrix(MatResponseMode, GaussPoint * gp, TimeStep * tStep) const override; void give3dKappaMatrix(FloatMatrix &answer, MatResponseMode mode, GaussPoint *gp, TimeStep *tStep); void give3dGprime(FloatMatrix &answer, MatResponseMode mode, GaussPoint *gp, TimeStep *tStep); diff --git a/src/sm/Materials/BoneMaterials/trabbonenl3d.C b/src/sm/Materials/BoneMaterials/trabbonenl3d.C index ce5d711a4..6b722642f 100644 --- a/src/sm/Materials/BoneMaterials/trabbonenl3d.C +++ b/src/sm/Materials/BoneMaterials/trabbonenl3d.C @@ -414,7 +414,6 @@ int TrabBoneNL3D :: packUnknowns(DataStream &buff, TimeStep *tStep, GaussPoint *ip) { abort(); - return 0; #if 0 IDNLMaterialStatus *nlStatus = static_cast< IDNLMaterialStatus * >( this->giveStatus(ip) ); @@ -430,7 +429,6 @@ int TrabBoneNL3D :: unpackAndUpdateUnknowns(DataStream &buff, TimeStep *tStep, GaussPoint *ip) { abort(); - return 0; #if 0 int result; IDNLMaterialStatus *nlStatus = static_cast< IDNLMaterialStatus * >( this->giveStatus(ip) ); @@ -447,7 +445,6 @@ int TrabBoneNL3D :: estimatePackSize(DataStream &buff, GaussPoint *ip) { abort(); - return 0; #if 0 // Note: nlStatus localStrainVectorForAverage memeber must be properly sized! // IDNLMaterialStatus *nlStatus = (IDNLMaterialStatus*) this -> giveStatus (ip); diff --git a/src/sm/Materials/BoneMaterials/trabbonenlembed.C b/src/sm/Materials/BoneMaterials/trabbonenlembed.C index 1bbdbee21..fbd99b367 100644 --- a/src/sm/Materials/BoneMaterials/trabbonenlembed.C +++ b/src/sm/Materials/BoneMaterials/trabbonenlembed.C @@ -100,6 +100,7 @@ TrabBoneNLEmbed :: giveRealStressVector_3d(const FloatArrayF<6> &strain, GaussPo double TrabBoneNLEmbed :: computeCumPlastStrain(GaussPoint *gp, TimeStep *tStep) const { + /* auto status = static_cast< TrabBoneNLEmbedStatus * >( this->giveStatus(gp) ); this->buildNonlocalPointTable(gp); @@ -107,18 +108,19 @@ TrabBoneNLEmbed :: computeCumPlastStrain(GaussPoint *gp, TimeStep *tStep) const auto list = status->giveIntegrationDomainList(); - double nonlocalCumPlastStrain = 0.0; + //double nonlocalCumPlastStrain = 0.0; for ( auto &lir: *list ) { auto nonlocStatus = static_cast< TrabBoneNLEmbedStatus * >( this->giveStatus(lir.nearGp) ); double nonlocalContribution = nonlocStatus->giveLocalCumPlastStrainForAverage(); nonlocalContribution *= lir.weight; - nonlocalCumPlastStrain += nonlocalContribution; + //nonlocalCumPlastStrain += nonlocalContribution; } nonlocalCumPlastStrain /= status->giveIntegrationScale(); ///@todo This is never used. // double localCumPlastStrain = status->giveLocalCumPlastStrainForAverage(); // alpha = mParam*nonlocalCumPlastStrain +(1-mParam)*localCumPlastStrain ; + */ return 0.; } diff --git a/src/sm/Materials/ConcreteMaterials/compodamagemat.C b/src/sm/Materials/ConcreteMaterials/compodamagemat.C index da32492fa..981517254 100644 --- a/src/sm/Materials/ConcreteMaterials/compodamagemat.C +++ b/src/sm/Materials/ConcreteMaterials/compodamagemat.C @@ -192,7 +192,6 @@ void CompoDamageMat :: giveRealStressVector(FloatArray &answer, GaussPoint *gp, default: { OOFEM_ERROR("Material mode %s not supported", __MaterialModeToString(mMode) ); - i_max = 0; } } diff --git a/src/sm/Materials/ConcreteMaterials/concretedpm2.h b/src/sm/Materials/ConcreteMaterials/concretedpm2.h index 9137ba7f4..cf8704fd1 100644 --- a/src/sm/Materials/ConcreteMaterials/concretedpm2.h +++ b/src/sm/Materials/ConcreteMaterials/concretedpm2.h @@ -721,7 +721,7 @@ class ConcreteDPM2 : public StructuralMaterial int newtonIter = 0; /// Type of softening function used. - int softeningType = 0.; + int softeningType = 0; /// Input parameter which simulates a loading rate. Only for debugging purposes. double deltaTime = 0.; diff --git a/src/sm/Materials/ConcreteMaterials/concretefcm.C b/src/sm/Materials/ConcreteMaterials/concretefcm.C index d65d0ac6e..d9b0c57a2 100644 --- a/src/sm/Materials/ConcreteMaterials/concretefcm.C +++ b/src/sm/Materials/ConcreteMaterials/concretefcm.C @@ -559,7 +559,6 @@ ConcreteFCM :: computeEffectiveShearModulus(GaussPoint *gp, TimeStep *tStep, int crackB = 2; } else { OOFEM_ERROR("Unexpected value of index i (4, 5, 6 permitted only)"); - crackA = crackB = 0; // happy compiler } // total number of parallel cracks in both directions @@ -581,7 +580,6 @@ ConcreteFCM :: computeEffectiveShearModulus(GaussPoint *gp, TimeStep *tStep, int Geff = G * D2tot / ( G + D2tot ); } else { OOFEM_ERROR("Unknown Shear Mode"); - Geff = 0.; // happy compiler } } @@ -774,7 +772,6 @@ ConcreteFCM :: maxShearStress(GaussPoint *gp, TimeStep *tStep, int i) { dir_2 = 2; } else { OOFEM_ERROR("Unexpected number for shear stress (must be either 4, 5 or 6)."); - dir_1 = dir_2 = 0; // happy compiler } // from temporary strain @@ -793,7 +790,6 @@ ConcreteFCM :: maxShearStress(GaussPoint *gp, TimeStep *tStep, int i) { } else { OOFEM_ERROR("Unexpected shearStrengthType"); - maxTau = 0.; // happy compiler } return maxTau; @@ -853,7 +849,7 @@ ConcreteFCM :: giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType if ( type == IST_TensileStrength ) { answer.resize(1); answer.at(1) = this->giveTensileStrength(gp, tStep); - return 1.; + return 1; } else if ( type == IST_ResidualTensileStrength ) { diff --git a/src/sm/Materials/ConcreteMaterials/concretefcm.h b/src/sm/Materials/ConcreteMaterials/concretefcm.h index 80641ca11..7939c8df9 100644 --- a/src/sm/Materials/ConcreteMaterials/concretefcm.h +++ b/src/sm/Materials/ConcreteMaterials/concretefcm.h @@ -158,7 +158,7 @@ class ConcreteFCM : public FCMMaterial, public RandomMaterialExtensionInterface /// type of post-peak behavior in the normal direction to the crack plane enum SofteningType { ST_NONE, ST_Exponential, ST_Linear, ST_Hordijk, ST_UserDefinedCrack, ST_LinearHardeningStrain, ST_UserDefinedStrain, ST_Unknown }; - SofteningType softType; + SofteningType softType = ST_NONE; /// type of reduction of the shear stiffness caused by cracking enum ShearRetentionType { SHR_NONE, SHR_Const_ShearRetFactor, SHR_Const_ShearFactorCoeff, SHR_UserDefined_ShearRetFactor, SHR_Unknown }; diff --git a/src/sm/Materials/ConcreteMaterials/concretefcmviscoelastic.C b/src/sm/Materials/ConcreteMaterials/concretefcmviscoelastic.C index 6c75fb5f1..05b7162e8 100644 --- a/src/sm/Materials/ConcreteMaterials/concretefcmviscoelastic.C +++ b/src/sm/Materials/ConcreteMaterials/concretefcmviscoelastic.C @@ -143,7 +143,7 @@ ConcreteFCMViscoElastic::giveIPValue(FloatArray &answer, GaussPoint *gp, Interna if ( type == IST_TensileStrength ) { answer.resize(1); answer.at(1) = status->giveTensileStrength(); - return 1.; + return 1; } else if ( type == IST_ResidualTensileStrength ) { double sigma; int nCracks; diff --git a/src/sm/Materials/ConcreteMaterials/frcfcm.C b/src/sm/Materials/ConcreteMaterials/frcfcm.C index f1525dfb9..d1ba3d90c 100644 --- a/src/sm/Materials/ConcreteMaterials/frcfcm.C +++ b/src/sm/Materials/ConcreteMaterials/frcfcm.C @@ -840,7 +840,6 @@ FRCFCM :: computeEffectiveShearModulus(GaussPoint *gp, TimeStep *tStep, int shea crackB = 2; } else { OOFEM_ERROR("Unexpected value of index i (4, 5, 6 permitted only)"); - crackA = crackB = 0; // happy compiler } if ( ( this->isIntact(gp, crackA) ) || ( this->isIntact(gp, crackB) ) ) { diff --git a/src/sm/Materials/ConcreteMaterials/idmgrad.C b/src/sm/Materials/ConcreteMaterials/idmgrad.C index 093c98023..45ebc82cf 100644 --- a/src/sm/Materials/ConcreteMaterials/idmgrad.C +++ b/src/sm/Materials/ConcreteMaterials/idmgrad.C @@ -94,7 +94,7 @@ IsotropicGradientDamageMaterial :: hasMaterialModeCapability(MaterialMode mode) void IsotropicGradientDamageMaterial :: giveStiffnessMatrix(FloatMatrix &answer, - MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) + MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) const // // Returns characteristic material stiffness matrix of the receiver // diff --git a/src/sm/Materials/ConcreteMaterials/idmgrad.h b/src/sm/Materials/ConcreteMaterials/idmgrad.h index be1dd5612..2bb5c2d7c 100644 --- a/src/sm/Materials/ConcreteMaterials/idmgrad.h +++ b/src/sm/Materials/ConcreteMaterials/idmgrad.h @@ -97,7 +97,7 @@ class IsotropicGradientDamageMaterial : public IsotropicDamageMaterial1, Gradien void giveRealStressVectorGradientDamage(FloatArray &answer1, double &answer2, GaussPoint *gp, const FloatArray &totalStrain, double nonlocalCumulatedStrain, TimeStep *tStep) override; - void giveStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) override; + void giveStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) const override; void computeLocalDamageDrivingVariable(double &answer, GaussPoint *gp, TimeStep *tStep) override { } void giveNonlocalInternalForces_N_factor(double &answer, double nlddv, GaussPoint *gp, TimeStep *tStep) override; void giveNonlocalInternalForces_B_factor(FloatArray &answer, const FloatArray &nlddv, GaussPoint *gp, TimeStep *tStep) override; diff --git a/src/sm/Materials/ConcreteMaterials/idmnl1.C b/src/sm/Materials/ConcreteMaterials/idmnl1.C index a295f316d..8b5129293 100644 --- a/src/sm/Materials/ConcreteMaterials/idmnl1.C +++ b/src/sm/Materials/ConcreteMaterials/idmnl1.C @@ -945,7 +945,7 @@ IDNLMaterial :: predictRelativeComputationalCost(GaussPoint *gp) } IDNLMaterialStatus *status = static_cast< IDNLMaterialStatus * >( this->giveStatus(gp) ); - int size = status->giveIntegrationDomainList()->size(); + indexType size = status->giveIntegrationDomainList()->size(); // just a guess (size/10) found optimal // cost *= (1.0 + (size/10)*0.5); cost *= ( 1.0 + size / 15.0 ); diff --git a/src/sm/Materials/ConcreteMaterials/mazarsmodel.C b/src/sm/Materials/ConcreteMaterials/mazarsmodel.C index 4173d436c..1f1c31bec 100644 --- a/src/sm/Materials/ConcreteMaterials/mazarsmodel.C +++ b/src/sm/Materials/ConcreteMaterials/mazarsmodel.C @@ -389,7 +389,6 @@ double MazarsMaterial :: computeGt(double kappa, GaussPoint *gp) const } while ( nite++ < _MAZARS_MODEL_MAX_ITER ); OOFEM_ERROR("tension objectivity iteration internal error - no convergence"); - return 0.; // just to make the compiler happy } // evaluation of compression damage @@ -421,7 +420,6 @@ double MazarsMaterial :: computeGc(double kappa, GaussPoint *gp) const } while ( nite++ < _MAZARS_MODEL_MAX_ITER ); OOFEM_ERROR("compression objectivity iteration internal error - no convergence"); - return 0.; // just to make the compiler happy } void diff --git a/src/sm/Materials/InterfaceMaterials/intmatbilinczfagerstromrate.C b/src/sm/Materials/InterfaceMaterials/intmatbilinczfagerstromrate.C index 763eb3e3e..96549fea2 100644 --- a/src/sm/Materials/InterfaceMaterials/intmatbilinczfagerstromrate.C +++ b/src/sm/Materials/InterfaceMaterials/intmatbilinczfagerstromrate.C @@ -296,7 +296,7 @@ IntMatBilinearCZFagerstromRate :: giveFirstPKTraction_3d(const FloatArrayF<3> &d } -const double tolerance = 1.0e-12; // small number +//const double tolerance = 1.0e-12; // small number void IntMatBilinearCZFagerstromRate :: initializeFrom(InputRecord &ir) { diff --git a/src/sm/Materials/InterfaceMaterials/intmatbilinczjansson.C b/src/sm/Materials/InterfaceMaterials/intmatbilinczjansson.C index 28be7e758..3a39db3f2 100644 --- a/src/sm/Materials/InterfaceMaterials/intmatbilinczjansson.C +++ b/src/sm/Materials/InterfaceMaterials/intmatbilinczjansson.C @@ -354,7 +354,7 @@ IntMatBilinearCZJansson :: give3dStiffnessMatrix_dTdj(MatResponseMode rMode, Gau } -const double tolerance = 1.0e-12; // small number +//const double tolerance = 1.0e-12; // small number void IntMatBilinearCZJansson :: initializeFrom(InputRecord &ir) { diff --git a/src/sm/Materials/InterfaceMaterials/intmatbilinearcz.C b/src/sm/Materials/InterfaceMaterials/intmatbilinearcz.C index 81bcb4e5f..21cb81b69 100644 --- a/src/sm/Materials/InterfaceMaterials/intmatbilinearcz.C +++ b/src/sm/Materials/InterfaceMaterials/intmatbilinearcz.C @@ -234,7 +234,6 @@ FloatArrayF<3> IntMatBilinearCZ :: giveFirstPKTraction_3d(const FloatArrayF<3> & } OOFEM_ERROR("No convergence in."); - return {0., 0., 0.}; } FloatMatrixF<3,3> IntMatBilinearCZ :: give3dStiffnessMatrix_dTdj(MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) const diff --git a/src/sm/Materials/InterfaceMaterials/linkslip.C b/src/sm/Materials/InterfaceMaterials/linkslip.C index 396198633..369d371a4 100644 --- a/src/sm/Materials/InterfaceMaterials/linkslip.C +++ b/src/sm/Materials/InterfaceMaterials/linkslip.C @@ -141,7 +141,7 @@ LinkSlip :: evaluateBondStress(const double kappa) const OOFEM_ERROR("Unknown bond model type. Type should be 0, 1 or 2."); } - return 0.; //Should not be here. + // return 0.; //Should not be here. } diff --git a/src/sm/Materials/InterfaceMaterials/masonry02.C b/src/sm/Materials/InterfaceMaterials/masonry02.C index bc5fe42b0..d1cdcde9f 100644 --- a/src/sm/Materials/InterfaceMaterials/masonry02.C +++ b/src/sm/Materials/InterfaceMaterials/masonry02.C @@ -480,7 +480,7 @@ Masonry02 :: CreateStatus(GaussPoint *gp) const void Masonry02 :: giveStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, - GaussPoint *gp, TimeStep *tStep) + GaussPoint *gp, TimeStep *tStep) const // // Returns characteristic material stiffness matrix of the receiver // @@ -498,7 +498,7 @@ Masonry02 :: giveStiffnessMatrix(FloatMatrix &answer, void Masonry02 :: give2dInterfaceMaterialStiffnessMatrix(FloatMatrix &answer, MatResponseMode mode, - GaussPoint *gp, TimeStep *tStep) + GaussPoint *gp, TimeStep *tStep) const { if ( mode == TangentStiffness ) { if ( rmType == mpm_ClosestPoint ) { diff --git a/src/sm/Materials/InterfaceMaterials/masonry02.h b/src/sm/Materials/InterfaceMaterials/masonry02.h index cd0bc8945..32cc623b3 100644 --- a/src/sm/Materials/InterfaceMaterials/masonry02.h +++ b/src/sm/Materials/InterfaceMaterials/masonry02.h @@ -113,7 +113,7 @@ class Masonry02 : public MPlasticMaterial2 void giveStiffnessMatrix(FloatMatrix &answer, MatResponseMode mode, GaussPoint *gp, - TimeStep *tStep) override; + TimeStep *tStep) const override; int giveSizeOfFullHardeningVarsVector() const override { return 3; } int giveSizeOfReducedHardeningVarsVector(GaussPoint *) const override { return 3; } @@ -158,7 +158,7 @@ class Masonry02 : public MPlasticMaterial2 void give2dInterfaceMaterialStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, - GaussPoint *gp, TimeStep *tStep); + GaussPoint *gp, TimeStep *tStep) const; void computeReducedElasticModuli(FloatMatrix &answer, GaussPoint *gp, TimeStep *tStep) const override; diff --git a/src/sm/Materials/InterfaceMaterials/structuralinterfacematerial.h b/src/sm/Materials/InterfaceMaterials/structuralinterfacematerial.h index 1bb5e3b62..2301b6def 100644 --- a/src/sm/Materials/InterfaceMaterials/structuralinterfacematerial.h +++ b/src/sm/Materials/InterfaceMaterials/structuralinterfacematerial.h @@ -95,7 +95,7 @@ class StructuralInterfaceMaterial : public Material virtual double giveFirstPKTraction_1d(double jump, double reducedF, GaussPoint *gp, TimeStep *tStep) const; virtual FloatArrayF<2> giveFirstPKTraction_2d(const FloatArrayF<2> &jump, const FloatMatrixF<2,2> &reducedF, GaussPoint *gp, TimeStep *tStep) const; virtual FloatArrayF<3> giveFirstPKTraction_3d(const FloatArrayF<3> &jump, const FloatMatrixF<3,3> &F, GaussPoint *gp, TimeStep *tStep) const - { OOFEM_ERROR("not implemented "); return FloatArrayF<3>(); } + { OOFEM_ERROR("not implemented "); } virtual double giveEngTraction_1d(double jump, GaussPoint *gp, TimeStep *tStep) const; virtual FloatArrayF<2> giveEngTraction_2d(const FloatArrayF<2> &jump, GaussPoint *gp, TimeStep *tStep) const; diff --git a/src/sm/Materials/LatticeMaterials/latticedamage.C b/src/sm/Materials/LatticeMaterials/latticedamage.C index 1747fb8d2..599436904 100644 --- a/src/sm/Materials/LatticeMaterials/latticedamage.C +++ b/src/sm/Materials/LatticeMaterials/latticedamage.C @@ -208,7 +208,6 @@ LatticeDamage :: give3dLatticeStiffnessMatrix(MatResponseMode mode, GaussPoint * return elastic * ( 1. - omega ); } else { OOFEM_ERROR("Unsupported stiffness mode\n"); - return elastic; } } @@ -232,7 +231,6 @@ LatticeDamage :: give2dLatticeStiffnessMatrix(MatResponseMode mode, GaussPoint * return elastic * ( 1. - omega ); } else { OOFEM_ERROR("Unsupported stiffness mode\n"); - return elastic; } } @@ -352,7 +350,6 @@ LatticeDamage :: computeBiot(double omega, double kappa, double le) const } } else { OOFEM_ERROR("Wrong stype for btype=1. Only linear and exponential softening considered so far\n"); - return 0.; } } diff --git a/src/sm/Materials/LatticeMaterials/latticelinearelastic.C b/src/sm/Materials/LatticeMaterials/latticelinearelastic.C index fe7e7f1b3..da8957900 100644 --- a/src/sm/Materials/LatticeMaterials/latticelinearelastic.C +++ b/src/sm/Materials/LatticeMaterials/latticelinearelastic.C @@ -186,7 +186,8 @@ FloatMatrixF< 6, 6 > LatticeLinearElastic :: give3dLatticeStiffnessMatrix(MatResponseMode rmode, GaussPoint *gp, TimeStep *atTime) const { //Needed to make sure that status exists before random values are requested for elastic stiffness. Problem is that gp->giveMaterialStatus does not check if status exist already - static_cast< LatticeMaterialStatus * >( this->giveStatus(gp) ); + + //static_cast< LatticeMaterialStatus * >( this->giveStatus(gp) ); FloatArrayF< 6 >d = { 1., @@ -205,7 +206,8 @@ FloatMatrixF< 3, 3 > LatticeLinearElastic :: give2dLatticeStiffnessMatrix(MatResponseMode rmode, GaussPoint *gp, TimeStep *atTime) const { //Needed to make sure that status exists before random values are requested for elastic stiffness. Problem is that gp->giveMaterialStatus does not check if status exist already - static_cast< LatticeMaterialStatus * >( this->giveStatus(gp) ); + + //static_cast< LatticeMaterialStatus * >( this->giveStatus(gp) ); FloatArrayF< 3 >d = { 1., diff --git a/src/sm/Materials/LatticeMaterials/latticeplasticitydamage.C b/src/sm/Materials/LatticeMaterials/latticeplasticitydamage.C index 25c9acdd6..6484a2530 100644 --- a/src/sm/Materials/LatticeMaterials/latticeplasticitydamage.C +++ b/src/sm/Materials/LatticeMaterials/latticeplasticitydamage.C @@ -856,7 +856,6 @@ LatticePlasticityDamage::give3dLatticeStiffnessMatrix(MatResponseMode mode, Gaus return elastic * ( 1. - omega ); } else { OOFEM_ERROR("Unsupported stiffness mode\n"); - return elastic; } } diff --git a/src/sm/Materials/LatticeMaterials/latticeplasticitydamageviscoelastic.C b/src/sm/Materials/LatticeMaterials/latticeplasticitydamageviscoelastic.C index 6e7616ad8..9af6d38c6 100644 --- a/src/sm/Materials/LatticeMaterials/latticeplasticitydamageviscoelastic.C +++ b/src/sm/Materials/LatticeMaterials/latticeplasticitydamageviscoelastic.C @@ -290,7 +290,6 @@ LatticePlasticityDamageViscoelastic::give3dLatticeStiffnessMatrix(MatResponseMod return answer * ( 1. - omega ); } else { OOFEM_ERROR("Unsupported stiffness mode\n"); - return answer; } } diff --git a/src/sm/Materials/LatticeMaterials/latticestructuralmaterial.C b/src/sm/Materials/LatticeMaterials/latticestructuralmaterial.C index 35dab9d56..394c61858 100644 --- a/src/sm/Materials/LatticeMaterials/latticestructuralmaterial.C +++ b/src/sm/Materials/LatticeMaterials/latticestructuralmaterial.C @@ -65,7 +65,7 @@ LatticeStructuralMaterial :: hasMaterialModeCapability(MaterialMode mode) const void LatticeStructuralMaterial :: giveStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, - GaussPoint *gp, TimeStep *tStep) + GaussPoint *gp, TimeStep *tStep) const // // Returns characteristic material stiffness matrix of the receiver // @@ -100,7 +100,7 @@ LatticeStructuralMaterial :: giveLatticeStress1d(double strain, GaussPoint *gp, FloatArrayF< 6 >tempStrain; tempStrain [ 0 ] = strain; auto answer = giveLatticeStress3d(tempStrain, gp, tStep); - return answer [ { 0 } ]; + return answer [ 0 ]; } FloatArrayF< 3 > diff --git a/src/sm/Materials/LatticeMaterials/latticestructuralmaterial.h b/src/sm/Materials/LatticeMaterials/latticestructuralmaterial.h index cc54a132f..20497ae11 100644 --- a/src/sm/Materials/LatticeMaterials/latticestructuralmaterial.h +++ b/src/sm/Materials/LatticeMaterials/latticestructuralmaterial.h @@ -82,7 +82,7 @@ class LatticeStructuralMaterial : public StructuralMaterial void giveStiffnessMatrix(FloatMatrix &answer, MatResponseMode mode, GaussPoint *gp, - TimeStep *tStep) override; + TimeStep *tStep) const override; virtual bool hasAnalyticalTangentStiffness() const { return true; } diff --git a/src/sm/Materials/MixedPressure/mixedpressurematerialextensioninterface.C b/src/sm/Materials/MixedPressure/mixedpressurematerialextensioninterface.C index b439f3e30..87f01a02d 100644 --- a/src/sm/Materials/MixedPressure/mixedpressurematerialextensioninterface.C +++ b/src/sm/Materials/MixedPressure/mixedpressurematerialextensioninterface.C @@ -60,9 +60,9 @@ MixedPressureMaterialExtensionInterface :: giveRealStressVector(FloatArray &answ ///@todo Move this to StructuralCrossSection ? MaterialMode mode = gp->giveMaterialMode(); if ( mode == _3dMat ) { - this->giveRealStressVector_3d(answer, gp, reducedStrain, pressure, tStep); + this->giveRealStressVectorUP_3d(answer, gp, reducedStrain, pressure, tStep); } else if ( mode == _PlaneStrain ) { - this->giveRealStressVector_PlaneStrain(answer, gp, reducedStrain, pressure, tStep); + this->giveRealStressVectorUP_PlaneStrain(answer, gp, reducedStrain, pressure, tStep); } else { OOFEM_ERROR("Unknown material mode for the mixed u-p formulation"); } @@ -88,11 +88,11 @@ MixedPressureMaterialExtensionInterface :: giveDeviatoricConstitutiveMatrix(Flo void -MixedPressureMaterialExtensionInterface :: giveRealStressVector_PlaneStrain(FloatArray &answer, GaussPoint *gp, const FloatArray &reducedStrain, double pressure, TimeStep *tStep) +MixedPressureMaterialExtensionInterface :: giveRealStressVectorUP_PlaneStrain(FloatArray &answer, GaussPoint *gp, const FloatArray &reducedStrain, double pressure, TimeStep *tStep) { FloatArray vE, vS; StructuralMaterial :: giveFullSymVectorForm(vE, reducedStrain, _PlaneStrain); - this->giveRealStressVector_3d(vS, gp, vE, pressure, tStep); + this->giveRealStressVectorUP_3d(vS, gp, vE, pressure, tStep); StructuralMaterial :: giveReducedSymVectorForm(answer, vS, _PlaneStrain); } } diff --git a/src/sm/Materials/MixedPressure/mixedpressurematerialextensioninterface.h b/src/sm/Materials/MixedPressure/mixedpressurematerialextensioninterface.h index 370ffb77e..38d06f991 100644 --- a/src/sm/Materials/MixedPressure/mixedpressurematerialextensioninterface.h +++ b/src/sm/Materials/MixedPressure/mixedpressurematerialextensioninterface.h @@ -93,8 +93,8 @@ class MixedPressureMaterialExtensionInterface : public Interface void giveRealStressVector(FloatArray &answer, GaussPoint *gp, const FloatArray &reducedStrain, double pressure, TimeStep *tStep); - virtual void giveRealStressVector_3d(FloatArray &answer, GaussPoint *gp, const FloatArray &reducedStrain, double pressure, TimeStep *tStep) = 0; - virtual void giveRealStressVector_PlaneStrain(FloatArray &answer, GaussPoint *gp, const FloatArray &reducedStrain, double pressure, TimeStep *tStep); + virtual void giveRealStressVectorUP_3d(FloatArray &answer, GaussPoint *gp, const FloatArray &reducedStrain, double pressure, TimeStep *tStep) = 0; + virtual void giveRealStressVectorUP_PlaneStrain(FloatArray &answer, GaussPoint *gp, const FloatArray &reducedStrain, double pressure, TimeStep *tStep); // virtual void giveRealStressVector_PlaneStress(FloatArray &answer, GaussPoint *gp, const FloatArray &reducedStrain, double pressure, TimeStep *tStep) = 0; virtual void giveFiniteStrainGeneralizedStressVectors(FloatArray &sigma, GaussPoint *gp, const FloatArray &devF, double pressure, TimeStep *tStep) {; } diff --git a/src/sm/Materials/RheoChainMaterials/b3solidmat.C b/src/sm/Materials/RheoChainMaterials/b3solidmat.C index 9cf4e3caa..1e5019f96 100644 --- a/src/sm/Materials/RheoChainMaterials/b3solidmat.C +++ b/src/sm/Materials/RheoChainMaterials/b3solidmat.C @@ -529,7 +529,6 @@ B3SolidMaterial :: computeFlowTermViscosity(GaussPoint *gp, TimeStep *tStep) con return 1. * tHalfStep / q4; } else { OOFEM_ERROR("mode is not supported"); - return 0.; } } @@ -673,7 +672,6 @@ B3SolidMaterial :: computeMicroPrestress(GaussPoint *gp, TimeStep *tStep, int op humNew = humOld + 0.5 * ( this->giveHumidityIncrement(gp, tStep) ); //linearly approximated } else { OOFEM_ERROR("invalid option parameter"); - humNew = 0.; } //following section is used if humidity remains constant diff --git a/src/sm/Materials/RheoChainMaterials/kelvinChSolM.C b/src/sm/Materials/RheoChainMaterials/kelvinChSolM.C index c325e3ec9..dfc70ef83 100644 --- a/src/sm/Materials/RheoChainMaterials/kelvinChSolM.C +++ b/src/sm/Materials/RheoChainMaterials/kelvinChSolM.C @@ -237,7 +237,6 @@ double KelvinChainSolidMaterial :: computeCreepFunction(double t, double t_prime, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("function has not been yet implemented to KelvinChainSolidMaterialStatus.C"); - return 0.; } diff --git a/src/sm/Materials/RheoChainMaterials/mps.C b/src/sm/Materials/RheoChainMaterials/mps.C index e14c83cf8..b30a2a4ca 100644 --- a/src/sm/Materials/RheoChainMaterials/mps.C +++ b/src/sm/Materials/RheoChainMaterials/mps.C @@ -1475,7 +1475,7 @@ MPSMaterial::giveHumidity(GaussPoint *gp, TimeStep *tStep, int option) const default: OOFEM_ERROR("option %d not supported", option); } - return 0.; // happy compiler + // return 0.; // happy compiler } @@ -1529,7 +1529,7 @@ MPSMaterial::giveHumidityNano(GaussPoint *gp, TimeStep *tStep, int option) const default: OOFEM_ERROR("option %d not supported", option); } - return 0.; // happy compiler + // return 0.; // happy compiler } double @@ -1587,7 +1587,7 @@ MPSMaterial::giveTemperature(GaussPoint *gp, TimeStep *tStep, int option) const default: OOFEM_ERROR("option %d not supported", option); } - return 0.; // happy compiler + // return 0.; // happy compiler } double @@ -1619,7 +1619,6 @@ MPSMaterial::computePsiR(GaussPoint *gp, TimeStep *tStep, int option) const return betaRH * betaRT; } else { OOFEM_ERROR("mode is not supported"); - return 0.; } } @@ -1653,7 +1652,6 @@ MPSMaterial::computePsiS(GaussPoint *gp, TimeStep *tStep) const return betaSH * betaST; } else { OOFEM_ERROR("mode is not supported"); - return 0.; } } @@ -1682,7 +1680,6 @@ MPSMaterial::computePsiE(GaussPoint *gp, TimeStep *tStep) const return hydrationTimescale * betaEH * betaET; } else { OOFEM_ERROR(" mode is not supported"); - return 0.; } } @@ -1705,7 +1702,6 @@ MPSMaterial::computeEquivalentTime(GaussPoint *gp, TimeStep *tStep, int option) return this->relMatAge - tStep->giveTimeIncrement() + PsiE * tStep->giveTimeIncrement(); } else { OOFEM_ERROR("mode is not supported"); - return 0.; } } else { MPSMaterialStatus *status = static_cast< MPSMaterialStatus * >( this->giveStatus(gp) ); @@ -1760,6 +1756,6 @@ MPSMaterial::giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType t } else { return RheoChainMaterial::giveIPValue(answer, gp, type, tStep); } - return 0; // to make the compiler happy + // return 0; // to make the compiler happy } } // end namespace oofem diff --git a/src/sm/Materials/RheoChainMaterials/mpsdammat.C b/src/sm/Materials/RheoChainMaterials/mpsdammat.C index dabad69a1..bfa974002 100644 --- a/src/sm/Materials/RheoChainMaterials/mpsdammat.C +++ b/src/sm/Materials/RheoChainMaterials/mpsdammat.C @@ -893,6 +893,6 @@ MPSDamMaterial :: giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateT return MPSMaterial :: giveIPValue(answer, gp, type, tStep); } - return 1; // to make the compiler happy + // return 1; // to make the compiler happy } } // end namespace oofem diff --git a/src/sm/Materials/RheoChainMaterials/rheoChM.C b/src/sm/Materials/RheoChainMaterials/rheoChM.C index dea00adf2..fd9f0494f 100644 --- a/src/sm/Materials/RheoChainMaterials/rheoChM.C +++ b/src/sm/Materials/RheoChainMaterials/rheoChM.C @@ -666,7 +666,7 @@ RheoChainMaterial :: giveIPValue(FloatArray &answer, GaussPoint *gp, InternalSta return StructuralMaterial :: giveIPValue(answer, gp, type, tStep); } - return 1; // to make the compiler happy + // return 1; // to make the compiler happy } /****************************************************************************************/ diff --git a/src/sm/Materials/RheoChainMaterials/rheoChM.h b/src/sm/Materials/RheoChainMaterials/rheoChM.h index 15846a44f..20e739e45 100644 --- a/src/sm/Materials/RheoChainMaterials/rheoChM.h +++ b/src/sm/Materials/RheoChainMaterials/rheoChM.h @@ -142,7 +142,7 @@ class RheoChainMaterial : public StructuralMaterial /// thermal dilatation coeff. double talpha = 0.; /// Number of (Maxwell or Kelvin) units in the rheologic chain. - int nUnits = 0.; + int nUnits = 0; /// Physical age of the material at castingTime double relMatAge = 0.; diff --git a/src/sm/Materials/abaqususermaterial.C b/src/sm/Materials/abaqususermaterial.C index b40f1c9d6..406708b1b 100644 --- a/src/sm/Materials/abaqususermaterial.C +++ b/src/sm/Materials/abaqususermaterial.C @@ -50,8 +50,8 @@ namespace oofem { REGISTER_Material(AbaqusUserMaterial); -int const AbaqusUserMaterial::abq2oo9[ 9 ] = { 0, 1, 2, 5, 4, 3, 6, 8, 7 }; -int const AbaqusUserMaterial::abq2oo6[ 6 ] = { 0, 1, 2, 5, 4, 3 }; +std::size_t const AbaqusUserMaterial::abq2oo9[ 9 ] = { 0, 1, 2, 5, 4, 3, 6, 8, 7 }; +std::size_t const AbaqusUserMaterial::abq2oo6[ 6 ] = { 0, 1, 2, 5, 4, 3 }; AbaqusUserMaterial::AbaqusUserMaterial(int n, Domain *d) : StructuralMaterial(n, d) diff --git a/src/sm/Materials/abaqususermaterial.h b/src/sm/Materials/abaqususermaterial.h index bc442e20c..cdca9af0d 100644 --- a/src/sm/Materials/abaqususermaterial.h +++ b/src/sm/Materials/abaqususermaterial.h @@ -120,8 +120,8 @@ class AbaqusUserMaterial : public StructuralMaterial /// Name of the file that contains the umat function std::string filename; - static int const abq2oo9[ 9 ]; - static int const abq2oo6[ 6 ]; + static std::size_t const abq2oo9[ 9 ]; + static std::size_t const abq2oo6[ 6 ]; public: /// Constructor. diff --git a/src/sm/Materials/anisodamagemodel.C b/src/sm/Materials/anisodamagemodel.C index bcdebeeed..1c33d8649 100644 --- a/src/sm/Materials/anisodamagemodel.C +++ b/src/sm/Materials/anisodamagemodel.C @@ -1251,7 +1251,6 @@ FloatMatrixF<1,1> AnisotropicDamageMaterial :: give1dStressStiffMtrx(MatResponse //@todo eq 57 } OOFEM_ERROR("not implemented"); - return {0.}; } } diff --git a/src/sm/Materials/druckerPragerPlasticitySM.C b/src/sm/Materials/druckerPragerPlasticitySM.C index b245dcb9f..352b80fa5 100644 --- a/src/sm/Materials/druckerPragerPlasticitySM.C +++ b/src/sm/Materials/druckerPragerPlasticitySM.C @@ -478,7 +478,6 @@ DruckerPragerPlasticitySM :: computeYieldStressInShear(double kappa, double eM) default: //StructuralMaterial :: OOFEM_ERROR( "Case failed: choose linear hardening/softening (1), exponential hardening/softening (2) in input file.") ; OOFEM_ERROR("Case failed: choose linear hardening/softening (1), exponential hardening/softening (2) in input file."); - return 0.; } } @@ -498,7 +497,6 @@ DruckerPragerPlasticitySM :: computeYieldStressPrime(double kappa, double eM) co default: //StructuralMaterial :: OOFEM_ERROR( "Case failed: choose linear hardening/softening (1), exponential hardening/softening (2) in input file.") ; OOFEM_ERROR("Case failed: choose linear hardening/softening (1), exponential hardening/softening (2) in input file."); - return 0.; } } @@ -537,9 +535,8 @@ DruckerPragerPlasticitySM :: give3dMaterialStiffnessMatrix(MatResponseMode mode, default: OOFEM_ERROR("Switch failed: Only elastic and tangent stiffness are supported."); - break; } - return FloatMatrixF<6,6>(); + // return FloatMatrixF<6,6>(); } FloatMatrixF<6,6> diff --git a/src/sm/Materials/dustmat.C b/src/sm/Materials/dustmat.C index 7228efd0d..20eab864a 100644 --- a/src/sm/Materials/dustmat.C +++ b/src/sm/Materials/dustmat.C @@ -515,7 +515,7 @@ DustMaterial :: giveIPValue(FloatArray &answer, return StructuralMaterial :: giveIPValue(answer, gp, type, tStep); } - return 0; + // return 0; } MaterialStatus * diff --git a/src/sm/Materials/fcm.C b/src/sm/Materials/fcm.C index dc9874b98..8109cd214 100644 --- a/src/sm/Materials/fcm.C +++ b/src/sm/Materials/fcm.C @@ -1074,7 +1074,6 @@ FCMMaterial :: isIntactForShear(GaussPoint *gp, int i) { normal_2 = 2; } else { OOFEM_ERROR("Unexpected number for shear stress (must be either 4, 5 or 6)."); - normal_1 = normal_2 = 0; } // any crack had existed in previous steps - newly inserted condition @@ -1875,7 +1874,6 @@ FCMMaterial :: computeTotalD2Modulus(GaussPoint *gp, TimeStep *tStep, int shearD crackB = 2; } else { OOFEM_ERROR("Unexpected value of index i (4, 5, 6 permitted only)"); - crackA = crackB = 0; } if ( ( this->isIntact(gp, crackA) ) || ( this->isIntact(gp, crackB) ) ) { @@ -1947,7 +1945,6 @@ FCMMaterial :: computeNumerD2Modulus(GaussPoint *gp, TimeStep *tStep, int shearD crackB = 2; } else { OOFEM_ERROR("Unexpected value of index i (4, 5, 6 permitted only)"); - crackA = crackB = 0; } if ( ( this->isIntact(gp, crackA) ) || ( this->isIntact(gp, crackB) ) ) { @@ -2066,7 +2063,6 @@ FCMMaterial :: giveNumberOfCracksForShearDirection(GaussPoint *gp, int i) dir_2 = 2; } else { OOFEM_ERROR("Unexpected value of index i (4, 5, 6 permitted only)"); - dir_1 = dir_2 = 0; } N = max( this->giveNumberOfCracksInDirection(gp, dir_1), this->giveNumberOfCracksInDirection(gp, dir_2) ); diff --git a/src/sm/Materials/isodamagemodel.h b/src/sm/Materials/isodamagemodel.h index 04bcf95b1..3c38f9b9b 100644 --- a/src/sm/Materials/isodamagemodel.h +++ b/src/sm/Materials/isodamagemodel.h @@ -295,7 +295,6 @@ class IsotropicDamageMaterial : public StructuralMaterial */ virtual double damageFunctionPrime(double kappa, GaussPoint *gp) const { OOFEM_ERROR("not implemented"); - return 0; } FloatMatrixF<3,3> givePlaneStressStiffMtrx(MatResponseMode mmode, GaussPoint *gp,TimeStep *tStep) const override; diff --git a/src/sm/Materials/isolinearelasticmaterial.C b/src/sm/Materials/isolinearelasticmaterial.C index 7cffef714..d1f6afc37 100644 --- a/src/sm/Materials/isolinearelasticmaterial.C +++ b/src/sm/Materials/isolinearelasticmaterial.C @@ -259,7 +259,7 @@ IsotropicLinearElasticMaterial :: giveDeviatoricPlaneStrainStiffMtrx(FloatMatrix void -IsotropicLinearElasticMaterial :: giveRealStressVector_3d(FloatArray &answer, GaussPoint *gp, const FloatArray &reducedStrain, double pressure, TimeStep *tStep) +IsotropicLinearElasticMaterial :: giveRealStressVectorUP_3d(FloatArray &answer, GaussPoint *gp, const FloatArray &reducedStrain, double pressure, TimeStep *tStep) { FloatArray strainVector; FloatMatrix d; @@ -281,7 +281,7 @@ IsotropicLinearElasticMaterial :: giveRealStressVector_3d(FloatArray &answer, Ga void -IsotropicLinearElasticMaterial :: giveRealStressVector_PlaneStrain(FloatArray &answer, GaussPoint *gp, const FloatArray &reducedStrain, double pressure, TimeStep *tStep) +IsotropicLinearElasticMaterial :: giveRealStressVectorUP_PlaneStrain(FloatArray &answer, GaussPoint *gp, const FloatArray &reducedStrain, double pressure, TimeStep *tStep) { FloatArray strainVector; FloatMatrix d; diff --git a/src/sm/Materials/isolinearelasticmaterial.h b/src/sm/Materials/isolinearelasticmaterial.h index 791384f08..27d85da82 100644 --- a/src/sm/Materials/isolinearelasticmaterial.h +++ b/src/sm/Materials/isolinearelasticmaterial.h @@ -195,8 +195,8 @@ class IsotropicLinearElasticMaterial : public LinearElasticMaterial, public QCMa void giveInverseOfBulkModulus(double &answer, MatResponseMode mode, GaussPoint *gp, TimeStep *tStep) override { answer = 3. * ( 1. - 2. * nu ) / E; } - void giveRealStressVector_3d(FloatArray &answer, GaussPoint *gp, const FloatArray &reducedStrain, double pressure, TimeStep *tStep) override; - void giveRealStressVector_PlaneStrain(FloatArray &answer, GaussPoint *gp, const FloatArray &reducedStrain, double pressure, TimeStep *tStep) override; + void giveRealStressVectorUP_3d(FloatArray &answer, GaussPoint *gp, const FloatArray &reducedStrain, double pressure, TimeStep *tStep) override; + void giveRealStressVectorUP_PlaneStrain(FloatArray &answer, GaussPoint *gp, const FloatArray &reducedStrain, double pressure, TimeStep *tStep) override; }; } // end namespace oofem diff --git a/src/sm/Materials/lsmastermat.h b/src/sm/Materials/lsmastermat.h index 5d4e91579..81964faa6 100644 --- a/src/sm/Materials/lsmastermat.h +++ b/src/sm/Materials/lsmastermat.h @@ -90,7 +90,7 @@ class LargeStrainMasterMaterial : public StructuralMaterial TimeStep * tStep) const override; FloatArrayF<6> giveRealStressVector_3d(const FloatArrayF<6> &, GaussPoint *, TimeStep *) const override - { OOFEM_ERROR("not implemented, this material is designed for large strains only"); return zeros<6>(); } + { OOFEM_ERROR("not implemented, this material is designed for large strains only"); } FloatArrayF<9> giveFirstPKStressVector_3d(const FloatArrayF<9> &vF, GaussPoint *gp, TimeStep *tStep) const override; /// transformation matrices diff --git a/src/sm/Materials/lsmastermatgrad.C b/src/sm/Materials/lsmastermatgrad.C index 7c1aef2de..b4030e823 100644 --- a/src/sm/Materials/lsmastermatgrad.C +++ b/src/sm/Materials/lsmastermatgrad.C @@ -70,7 +70,7 @@ LargeStrainMasterMaterialGrad :: CreateStatus(GaussPoint *gp) const void -LargeStrainMasterMaterialGrad :: giveStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) +LargeStrainMasterMaterialGrad :: giveStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) const // // Returns characteristic material stiffness matrix of the receiver // diff --git a/src/sm/Materials/lsmastermatgrad.h b/src/sm/Materials/lsmastermatgrad.h index 433ce1a22..a61b54a98 100644 --- a/src/sm/Materials/lsmastermatgrad.h +++ b/src/sm/Materials/lsmastermatgrad.h @@ -70,7 +70,7 @@ class LargeStrainMasterMaterialGrad : public LargeStrainMasterMaterial, Gradient } } - void giveStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) override; + void giveStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) const override; void giveGradientDamageStiffnessMatrix_uu(FloatMatrix &answer, MatResponseMode mode, GaussPoint *gp, TimeStep *tStep) override; void giveGradientDamageStiffnessMatrix_du(FloatMatrix &answer, MatResponseMode mode, GaussPoint *gp, TimeStep *tStep) override; diff --git a/src/sm/Materials/micromaterial.C b/src/sm/Materials/micromaterial.C index 1e596d132..8af4cf72d 100644 --- a/src/sm/Materials/micromaterial.C +++ b/src/sm/Materials/micromaterial.C @@ -120,7 +120,6 @@ FloatArrayF<6> MicroMaterial :: giveRealStressVector_3d(const FloatArrayF<6> &to // StructuralMaterialStatus *status = static_cast< StructuralMaterialStatus * >( this->giveStatus(gp) ); OOFEM_ERROR("Should not be called, use giveInternalForcesVector instead"); - return zeros<6>(); // int nelem = microDomain->giveNumberOfElements(); // //int nnodes = microDomain->giveNumberOfDofManagers(); @@ -402,7 +401,7 @@ void MicroMaterial :: giveMacroStiffnessMatrix(FloatMatrix &answer, TimeStep *tS } //slaveMasterOnBoundary.printYourself(); -# ifdef DEBUG +# if 0 //check of the transformation matrix - the sum of each third column must be either zero or one double sum; for ( int i = 1; i <= slaveMasterOnBoundary.giveNumberOfRows(); i++ ) { @@ -413,7 +412,7 @@ void MicroMaterial :: giveMacroStiffnessMatrix(FloatMatrix &answer, TimeStep *tS } } - //OOFEM_LOG_INFO("Sum of %i row of transformation matrix row %f\n", i, sum); + OOFEM_LOG_INFO("Sum of %i row of transformation matrix row %f\n", i, sum); } # endif @@ -546,7 +545,6 @@ int MicroMaterial :: giveDofEquationNumber(Dof *dof) const break; default: OOFEM_ERROR("Node numbering undefined"); - return 0; } } diff --git a/src/sm/Materials/misesmat.C b/src/sm/Materials/misesmat.C index 054aad412..f79eaafb4 100644 --- a/src/sm/Materials/misesmat.C +++ b/src/sm/Materials/misesmat.C @@ -132,7 +132,7 @@ MisesMat::giveRealStressVector_1d(const FloatArrayF< 1 > &totalStrain, status->letTempStrainVectorBe(strain); status->setTempDamage(omega); status->letTempStressVectorBe(stress); - return stress [ { 0 } ]; + return stress [ 0 ]; #else return StructuralMaterial::giveRealStressVector_1d(totalStrain, gp, tStep); @@ -405,7 +405,7 @@ MisesMat::computeYieldStress(double kappa, GaussPoint *gp, TimeStep *tStep) cons { double yieldStress = 0.; if ( hType == 0 ) { - return this->give('s', gp, tStep) + this->H * kappa; // + ( this->sigInf - this->sig0 ) * (1. - exp(-expD*kappa)); + return this->giveS(gp, tStep) + this->H * kappa; // + ( this->sigInf - this->sig0 ) * (1. - exp(-expD*kappa)); } else { if ( kappa > h_eps.at(h_eps.giveSize() ) ) { OOFEM_ERROR("kappa outside range of specified hardening law/n"); @@ -660,7 +660,7 @@ MisesMat::giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateType type return 1; } else if ( type == IST_YieldStrength ) { answer.resize(1); - answer.at(1) = this->give('s', gp, tStep); + answer.at(1) = this->giveS(gp, tStep); return 1; } else { return StructuralMaterial::giveIPValue(answer, gp, type, tStep); @@ -729,15 +729,11 @@ MisesMatStatus::updateYourself(TimeStep *tStep) double -MisesMat::give(int aProperty, GaussPoint *gp, TimeStep *tStep) const +MisesMat::giveS(GaussPoint *gp, TimeStep *tStep) const { - if ( aProperty == 's' ) { - ///FIXME: const cast workaround, until all methods have been properly marked const properly: - return sig0.eval({ { "te", giveTemperature(gp, tStep) }, { "t", tStep->giveIntrinsicTime() } }, this->giveDomain(), gp, giveTemperature(gp, tStep) ); - } + return sig0.eval({ { "te", giveTemperature(gp, tStep) }, { "t", tStep->giveIntrinsicTime() } }, this->giveDomain(), gp, giveTemperature(gp, tStep) ); - return Material::give(aProperty, gp); } double MisesMat::giveTemperature(GaussPoint *gp, TimeStep *tStep) const diff --git a/src/sm/Materials/misesmat.h b/src/sm/Materials/misesmat.h index 905639c3c..9b2495aa2 100644 --- a/src/sm/Materials/misesmat.h +++ b/src/sm/Materials/misesmat.h @@ -141,7 +141,7 @@ class MisesMat : public StructuralMaterial FloatArrayF< 1 >giveRealStressVector_1d(const FloatArrayF< 1 > &reducedE, GaussPoint *gp, TimeStep *tStep) const override; - double give(int aProperty, GaussPoint *gp, TimeStep *tStep) const; + double giveS(GaussPoint *gp, TimeStep *tStep) const; double giveTemperature(GaussPoint *gp, TimeStep *tStep) const; protected: diff --git a/src/sm/Materials/misesmatgrad.C b/src/sm/Materials/misesmatgrad.C index 8c2ad0c53..2b371695d 100644 --- a/src/sm/Materials/misesmatgrad.C +++ b/src/sm/Materials/misesmatgrad.C @@ -61,7 +61,7 @@ MisesMatGrad :: hasMaterialModeCapability(MaterialMode mode) const void -MisesMatGrad :: giveStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) +MisesMatGrad :: giveStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) const // // Returns characteristic material stiffness matrix of the receiver // @@ -205,7 +205,7 @@ MisesMatGrad :: givePlaneStrainStiffMtrx(MatResponseMode mode, GaussPoint *gp, T // === plastic loading === // yield stress at the beginning of the step - double sigmaY = this->give('s', gp, tStep) + H * kappa; + double sigmaY = this->giveS( gp, tStep) + H * kappa; // trial deviatoric stress and its norm StressVector trialStressDev(status->giveTrialStressDev(), _PlaneStrain); double trialS = trialStressDev.computeStressNorm(); @@ -260,7 +260,7 @@ MisesMatGrad :: give3dMaterialStiffnessMatrix(MatResponseMode mode, GaussPoint * if ( dKappa > 0.0 ) { double tempDamage = status->giveTempDamage(); double damage = status->giveDamage(); - double sigmaY = this->give('s', gp, tStep) + H * kappa; + double sigmaY = this->giveS(gp, tStep) + H * kappa; // trial deviatoric stress and its norm const FloatArrayF<6> trialStressDev = status->giveTrialStressDev(); /*****************************************************/ diff --git a/src/sm/Materials/misesmatgrad.h b/src/sm/Materials/misesmatgrad.h index f0d0d5b8c..c89e356b0 100644 --- a/src/sm/Materials/misesmatgrad.h +++ b/src/sm/Materials/misesmatgrad.h @@ -97,7 +97,7 @@ class MisesMatGrad : public MisesMat, GradientDamageMaterialExtensionInterface } } - void giveStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) override; + void giveStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) const override; FloatMatrixF<1,1> give1dStressStiffMtrx(MatResponseMode, GaussPoint * gp, TimeStep * tStep) const override; FloatMatrixF<4,4> givePlaneStrainStiffMtrx(MatResponseMode, GaussPoint * gp, TimeStep * tStep) const override; diff --git a/src/sm/Materials/misesmatnl.C b/src/sm/Materials/misesmatnl.C index c158e2f70..f39599308 100644 --- a/src/sm/Materials/misesmatnl.C +++ b/src/sm/Materials/misesmatnl.C @@ -57,7 +57,6 @@ FloatArrayF<6> MisesMatNl :: giveRealStressVector_3d(const FloatArrayF<6> &strain, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("3D mode not supported"); - return zeros<6>(); } @@ -72,7 +71,7 @@ MisesMatNl :: giveRealStressVector_1d(const FloatArrayF<1> &totalStrain, GaussPo nlStatus->setTempDamage(tempDam); nlStatus->letTempStrainVectorBe(totalStrain); nlStatus->letTempStressVectorBe(stress); - return stress[{0}]; + return stress[0]; } diff --git a/src/sm/Materials/ortholinearelasticmaterial.C b/src/sm/Materials/ortholinearelasticmaterial.C index ca0a13ef3..c279ddab2 100644 --- a/src/sm/Materials/ortholinearelasticmaterial.C +++ b/src/sm/Materials/ortholinearelasticmaterial.C @@ -356,7 +356,6 @@ OrthotropicLinearElasticMaterial :: giveTensorRotationMatrix(GaussPoint *gp) con } } else { OOFEM_ERROR("internal error no cs defined"); - return eye<3>(); } // t at (i,j) contains cosine of angle between elementAxis(i) and localMaterialAxis(j). } diff --git a/src/sm/Materials/rankinemat.C b/src/sm/Materials/rankinemat.C index 639384fd8..c8d6e0a85 100644 --- a/src/sm/Materials/rankinemat.C +++ b/src/sm/Materials/rankinemat.C @@ -493,7 +493,6 @@ RankineMat :: give1dStressStiffMtrx(MatResponseMode mode, GaussPoint *gp, TimeSt return {E * (1.0 - om)}; } else { OOFEM_ERROR("unknown type of stiffness (secant stiffness not implemented for 1d)"); - return {0.}; } } diff --git a/src/sm/Materials/rankinematgrad.C b/src/sm/Materials/rankinematgrad.C index cb7d036e2..4477b27cb 100644 --- a/src/sm/Materials/rankinematgrad.C +++ b/src/sm/Materials/rankinematgrad.C @@ -88,7 +88,7 @@ RankineMatGrad :: hasMaterialModeCapability(MaterialMode mode) const } void -RankineMatGrad :: giveStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) +RankineMatGrad :: giveStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) const // // Returns characteristic material matrix of the receiver // diff --git a/src/sm/Materials/rankinematgrad.h b/src/sm/Materials/rankinematgrad.h index 5458cbd98..18b7cc4a7 100644 --- a/src/sm/Materials/rankinematgrad.h +++ b/src/sm/Materials/rankinematgrad.h @@ -121,7 +121,7 @@ class RankineMatGrad : public RankineMat, GradientDamageMaterialExtensionInterfa } } - void giveStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) override; + void giveStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, GaussPoint *gp, TimeStep *tStep) const override; void giveGradientDamageStiffnessMatrix_uu(FloatMatrix &answer, MatResponseMode mode, GaussPoint *gp, TimeStep *tStep) override; void giveGradientDamageStiffnessMatrix_ud(FloatMatrix &answer, MatResponseMode mode, GaussPoint *gp, TimeStep *tStep) override; diff --git a/src/sm/Materials/rankinematnl.C b/src/sm/Materials/rankinematnl.C index 424107172..7b74319ad 100644 --- a/src/sm/Materials/rankinematnl.C +++ b/src/sm/Materials/rankinematnl.C @@ -89,7 +89,7 @@ RankineMatNl :: giveRealStressVector_1d(const FloatArrayF<1> &totalStrain, Gauss double gf = sig0 * sig0 / E; // only estimated, but OK for this purpose nlStatus->computeWork_1d(gp, gf); #endif - return stress[{0}]; + return stress[0]; } diff --git a/src/sm/Materials/structuralmaterial.C b/src/sm/Materials/structuralmaterial.C index 117006545..2378b5b60 100644 --- a/src/sm/Materials/structuralmaterial.C +++ b/src/sm/Materials/structuralmaterial.C @@ -49,17 +49,17 @@ #include "dynamicinputrecord.h" namespace oofem { -std::array< std::array< int, 3 >, 3 >StructuralMaterial::vIindex = { - 1, 6, 5, - 9, 2, 4, - 8, 7, 3 -}; +std::array< std::array< int, 3 >, 3 >StructuralMaterial::vIindex = {{ + {1, 6, 5}, + {9, 2, 4}, + {8, 7, 3} +}}; -std::array< std::array< int, 3 >, 3 >StructuralMaterial::svIndex = { - 1, 6, 5, - 6, 2, 4, - 5, 4, 3 -}; +std::array< std::array< int, 3 >, 3 >StructuralMaterial::svIndex = {{ + {1, 6, 5}, + {6, 2, 4}, + {5, 4, 3} +}}; StructuralMaterial::StructuralMaterial(int n, Domain *d) : Material(n, d) { } @@ -75,6 +75,15 @@ StructuralMaterial::hasMaterialModeCapability(MaterialMode mode) const mode == _PlateLayer || mode == _2dBeamLayer || mode == _Fiber; } +void +StructuralMaterial::giveCharacteristicMatrix(FloatMatrix &answer, MatResponseMode type, GaussPoint* gp, TimeStep *tStep) const +{ + if (type == TangentStiffness) { + return this->giveStiffnessMatrix(answer, MatResponseMode::TangentStiffness, gp, tStep); + } else { + OOFEM_ERROR("Not implemented"); + } +} void StructuralMaterial::giveRealStressVector(FloatArray &answer, GaussPoint *gp, const FloatArray &reducedStrain, TimeStep *tStep) @@ -191,7 +200,6 @@ StructuralMaterial::giveRealStressVector_StressControl(const FloatArray &reduced } OOFEM_ERROR("Iteration did not converge after 100000 iterations\nS.norm=%e, err=%e, relErr=%e", vS.computeNorm(), reducedvS.computeNorm(), reducedvS.computeNorm() / vS.computeNorm() ); - return FloatArray(); } @@ -386,7 +394,6 @@ StructuralMaterial::giveFirstPKStressVector_StressControl(const FloatArray &redu } OOFEM_ERROR("Iteration did not converge"); - return FloatArray(); } @@ -605,7 +612,7 @@ StructuralMaterial::giveEshelbyStressVector_PlaneStrain(FloatArray &answer, Gaus void StructuralMaterial::giveStiffnessMatrix(FloatMatrix &answer, MatResponseMode rMode, - GaussPoint *gp, TimeStep *tStep) + GaussPoint *gp, TimeStep *tStep) const // // Returns characteristic material stiffness matrix of the receiver // @@ -1078,14 +1085,12 @@ FloatMatrixF< 3, 3 > StructuralMaterial::give2dPlateSubSoilStiffMtrx(MatResponseMode mmode, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("No general implementation provided"); - return FloatMatrixF< 3, 3 >(); } FloatMatrixF< 6, 6 > StructuralMaterial::give3dBeamSubSoilStiffMtrx(MatResponseMode mmode, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("No general implementation provided"); - return FloatMatrixF< 6, 6 >(); } void @@ -1946,7 +1951,7 @@ StructuralMaterial::sortPrincDirAndValCloseTo(FloatArray &pVal, FloatMatrix &pDi pVal.at(maxJ) = pVal.at(i); pVal.at(i) = swap; for ( int k = 1; k <= 3; k++ ) { - double swap = pDir.at(k, maxJ); + swap = pDir.at(k, maxJ); pDir.at(k, maxJ) = pDir.at(k, i); pDir.at(k, i) = swap; } diff --git a/src/sm/Materials/structuralmaterial.h b/src/sm/Materials/structuralmaterial.h index 5ee1bddb0..e3328c0e1 100644 --- a/src/sm/Materials/structuralmaterial.h +++ b/src/sm/Materials/structuralmaterial.h @@ -153,6 +153,8 @@ class OOFEM_EXPORT StructuralMaterial : public Material void initializeFrom(InputRecord &ir) override; void giveInputRecord(DynamicInputRecord &input) override; + void giveCharacteristicMatrix(FloatMatrix &answer, MatResponseMode type, GaussPoint* gp, TimeStep *tStep) const override; + /** * Computes the stiffness matrix for giveRealStressVector of receiver in given integration point, respecting its history. @@ -166,7 +168,7 @@ class OOFEM_EXPORT StructuralMaterial : public Material virtual void giveStiffnessMatrix(FloatMatrix &answer, MatResponseMode mode, GaussPoint *gp, - TimeStep *tStep); + TimeStep *tStep) const; /** * Computes the real stress vector for given total strain and integration point. diff --git a/src/sm/Materials/winklermodel.C b/src/sm/Materials/winklermodel.C index 19bfdc359..5b5b4b9cc 100644 --- a/src/sm/Materials/winklermodel.C +++ b/src/sm/Materials/winklermodel.C @@ -122,7 +122,6 @@ WinklerMaterial::give3dBeamSubSoilStiffMtrx(MatResponseMode mmode, GaussPoint *g return answer; } else { OOFEM_ERROR ("C1 attribute size error (shouldequal to 6 for 3dBeamSubsoil mode)"); - return FloatMatrixF<6,6>(); } } diff --git a/src/sm/Quasicontinuum/quasicontinuumnumberingscheme.C b/src/sm/Quasicontinuum/quasicontinuumnumberingscheme.C index 33e00f9b1..c1f12b7cf 100644 --- a/src/sm/Quasicontinuum/quasicontinuumnumberingscheme.C +++ b/src/sm/Quasicontinuum/quasicontinuumnumberingscheme.C @@ -44,7 +44,7 @@ QuasicontinuumNumberingscheme :: QuasicontinuumNumberingscheme() : { } void -QuasicontinuumNumberingscheme :: init(Domain *domain, std :: vector< bool >activatedNodeList, TimeStep *tStep) +QuasicontinuumNumberingscheme :: init2(Domain *domain, std :: vector< bool >activatedNodeList, TimeStep *tStep) { isInitialized = true; /* diff --git a/src/sm/Quasicontinuum/quasicontinuumnumberingscheme.h b/src/sm/Quasicontinuum/quasicontinuumnumberingscheme.h index 53640d6c9..9c7d2a1f9 100644 --- a/src/sm/Quasicontinuum/quasicontinuumnumberingscheme.h +++ b/src/sm/Quasicontinuum/quasicontinuumnumberingscheme.h @@ -73,7 +73,7 @@ class QuasicontinuumNumberingscheme : public UnknownNumberingScheme /** * Initializes the receiver */ - void init(Domain *domain, std::vector activatedNodeList, TimeStep *tStep); + void init2(Domain *domain, std::vector activatedNodeList, TimeStep *tStep); bool isDefault() const override { return true; } int giveDofEquationNumber(Dof *dof) const override; int giveRequiredNumberOfDomainEquation() const override; diff --git a/src/sm/export/gnuplotexportmodule.C b/src/sm/export/gnuplotexportmodule.C index ef69721e2..6fc7334e8 100644 --- a/src/sm/export/gnuplotexportmodule.C +++ b/src/sm/export/gnuplotexportmodule.C @@ -781,7 +781,7 @@ void GnuplotExportModule::outputBoundaryCondition(PrescribedGradientBCWeak &iBC, Element *e = iBC.giveDomain()->giveElement( boundaries.at(pos * 2 - 1) ); int boundary = boundaries.at(pos * 2); - const auto &bNodes = e->giveInterpolation()->boundaryGiveNodes(boundary); + const auto &bNodes = e->giveInterpolation()->boundaryGiveNodes(boundary, e->giveGeometryType()); std::vector bndSegNodes; @@ -861,7 +861,7 @@ void GnuplotExportModule::outputMesh(Domain &iDomain) for ( int edgeIndex = 1; edgeIndex <= numEdges; edgeIndex++ ) { std::vector points; - const auto &bNodes = el->giveInterpolation()->boundaryGiveNodes(edgeIndex); + const auto &bNodes = el->giveInterpolation()->boundaryGiveNodes(edgeIndex, el->giveGeometryType()); int niLoc = bNodes.at(1); const auto &xS = el->giveNode(niLoc)->giveCoordinates(); diff --git a/src/sm/prescribeddispslipbcdirichletrc.C b/src/sm/prescribeddispslipbcdirichletrc.C index 8d8e519b1..a6b36970f 100644 --- a/src/sm/prescribeddispslipbcdirichletrc.C +++ b/src/sm/prescribeddispslipbcdirichletrc.C @@ -481,7 +481,7 @@ double PrescribedDispSlipBCDirichletRC::domainSize( Domain *d, int set ) if ( this->giveDomain()->giveNumberOfSpatialDimensions() == 2 ) { //assuming that the RVE thickness is constant in 2D Element *e = this->giveDomain()->giveElement( this->giveDomain()->giveSet(conBoundSet)->giveBoundaryList().at(1) ); - std::unique_ptr ir = e->giveInterpolation()->giveIntegrationRule( e->giveInterpolation()->giveInterpolationOrder() ); + std::unique_ptr ir = e->giveInterpolation()->giveIntegrationRule( e->giveInterpolation()->giveInterpolationOrder(), e->giveGeometryType() ); CrossSection *cs = e->giveCrossSection(); GaussPoint *gp = ir->getIntegrationPoint(0); double thickness = cs->give(CS_Thickness, gp); diff --git a/src/sm/prescribeddispslipbcneumannrc.C b/src/sm/prescribeddispslipbcneumannrc.C index 431f05c54..d49d8fd65 100644 --- a/src/sm/prescribeddispslipbcneumannrc.C +++ b/src/sm/prescribeddispslipbcneumannrc.C @@ -669,7 +669,7 @@ void PrescribedDispSlipBCNeumannRC :: integrateTangentStress(FloatMatrix &oTange int order = interp->giveInterpolationOrder(); std :: unique_ptr< IntegrationRule > ir; - ir = interp->giveBoundaryIntegrationRule(order, iBndIndex); + ir = interp->giveBoundaryIntegrationRule(order, iBndIndex, e->giveGeometryType()); oTangent.clear(); @@ -734,7 +734,7 @@ void PrescribedDispSlipBCNeumannRC::integrateTangentBStressSteel( FloatMatrix &o FEInterpolation *interp = e->giveInterpolation(); int order = interp->giveInterpolationOrder(); std :: unique_ptr< IntegrationRule > ir; - ir = interp->giveIntegrationRule(order); + ir = interp->giveIntegrationRule(order, e->giveGeometryType()); oTangent.clear(); @@ -776,7 +776,7 @@ void PrescribedDispSlipBCNeumannRC::integrateTangentBStressConcrete( FloatMatrix FEInterpolation *interp = e->giveInterpolation(); int order = interp->giveInterpolationOrder(); std :: unique_ptr< IntegrationRule > ir; - ir = interp->giveIntegrationRule(order); + ir = interp->giveIntegrationRule(order, e->giveGeometryType()); oTangent.clear(); Nctau.resize(ndof,ndof); @@ -813,7 +813,7 @@ void PrescribedDispSlipBCNeumannRC::integrateTangentRStressSteel( FloatMatrix &o FEInterpolation *interp = e->giveInterpolation(); int order = interp->giveInterpolationOrder(); std :: unique_ptr< IntegrationRule > ir; - ir = interp->giveIntegrationRule(order); + ir = interp->giveIntegrationRule(order, e->giveGeometryType()); //Cast into StructuralElement StructuralElement *se = dynamic_cast(e); @@ -862,7 +862,7 @@ void PrescribedDispSlipBCNeumannRC::integrateTangentRStressConcrete( FloatMatrix //Interpolation order int order = interp->giveInterpolationOrder(); - std :: unique_ptr< IntegrationRule > ir = interp->giveBoundaryEdgeIntegrationRule(order, iBndIndex); + std :: unique_ptr< IntegrationRule > ir = interp->giveBoundaryEdgeIntegrationRule(order, iBndIndex, e->giveGeometryType()); oTangent.clear(); @@ -1075,7 +1075,7 @@ void PrescribedDispSlipBCNeumannRC::computeWeightMatrix( FloatMatrix &C, const I FEInterpolation *interp = e->giveInterpolation(); int order = interp->giveInterpolationOrder(); std :: unique_ptr< IntegrationRule > ir; - ir = interp->giveIntegrationRule(order); + ir = interp->giveIntegrationRule(order, e->giveGeometryType()); for ( auto &gp : *ir ) { const FloatArray &lcoords = gp->giveNaturalCoordinates(); @@ -1126,7 +1126,7 @@ double PrescribedDispSlipBCNeumannRC::computeInterfaceLength( const IntArray &re FEInterpolation *interp = e->giveInterpolation(); int order = interp->giveInterpolationOrder(); std :: unique_ptr< IntegrationRule > ir; - ir = interp->giveIntegrationRule(order); + ir = interp->giveIntegrationRule(order, e->giveGeometryType()); for ( auto &gp : *ir ) { const FloatArray &lcoords = gp->giveNaturalCoordinates(); @@ -1148,7 +1148,7 @@ double PrescribedDispSlipBCNeumannRC::domainSize( Domain *d, int set ) if ( this->giveDomain()->giveNumberOfSpatialDimensions() == 2 ) { //assuming that the RVE thickness is constant in 2D Element *e = this->giveDomain()->giveElement( this->giveDomain()->giveSet( this->giveSetNumber() )->giveBoundaryList().at(1) ); - std::unique_ptr ir = e->giveInterpolation()->giveIntegrationRule( e->giveInterpolation()->giveInterpolationOrder() ); + std::unique_ptr ir = e->giveInterpolation()->giveIntegrationRule( e->giveInterpolation()->giveInterpolationOrder(), e->giveGeometryType() ); CrossSection *cs = e->giveCrossSection(); GaussPoint *gp = ir->getIntegrationPoint(0); double thickness = cs->give(CS_Thickness, gp); diff --git a/src/sm/stressstrainbasevector.C b/src/sm/stressstrainbasevector.C index 7903ba05a..dea23dd1d 100644 --- a/src/sm/stressstrainbasevector.C +++ b/src/sm/stressstrainbasevector.C @@ -191,11 +191,9 @@ StressStrainBaseVector :: computeVolumetricPart() const if ( myMode == _1dMat ) { // 1D model OOFEM_ERROR("No Split for 1D!"); - return 0.0; } else if ( myMode == _PlaneStress ) { // plane stress problem OOFEM_ERROR("No Split for plane stress!"); - return 0.0; } else { // 3d, plane strain or axisymmetric problem return ( this->at(1) + this->at(2) + this->at(3) ) / 3.0; diff --git a/src/sm/transversereinfconstraint.C b/src/sm/transversereinfconstraint.C index c1150450a..b48d69114 100644 --- a/src/sm/transversereinfconstraint.C +++ b/src/sm/transversereinfconstraint.C @@ -332,7 +332,7 @@ void TransverseReinfConstraint :: integrateTangentOnSteel(FloatMatrix& oTangent, FEInterpolation *interp = e->giveInterpolation(); int order = interp->giveInterpolationOrder(); std :: unique_ptr< IntegrationRule > ir; - ir = interp->giveIntegrationRule(order); + ir = interp->giveIntegrationRule(order, e->giveGeometryType()); oTangent.clear(); @@ -375,7 +375,7 @@ void TransverseReinfConstraint :: integrateTangentOnConcrete(FloatMatrix &oTange FEInterpolation *interp = e->giveInterpolation(); int order = interp->giveInterpolationOrder(); std :: unique_ptr< IntegrationRule > ir; - ir = interp->giveBoundaryIntegrationRule(order, iBndIndex); + ir = interp->giveBoundaryIntegrationRule(order, iBndIndex, e->giveGeometryType()); oTangent.clear(); diff --git a/src/tm/BoundaryCondition/transportgradientdirichlet.C b/src/tm/BoundaryCondition/transportgradientdirichlet.C index dbb3b368f..7a4ff87d3 100644 --- a/src/tm/BoundaryCondition/transportgradientdirichlet.C +++ b/src/tm/BoundaryCondition/transportgradientdirichlet.C @@ -446,9 +446,9 @@ void TransportGradientDirichlet :: computeXi() FloatArray b; FEInterpolation3d *interp = static_cast< FEInterpolation3d* >( e->giveInterpolation() ); - const auto &bNodes = interp->boundaryEdgeGiveNodes(edge); + const auto &bNodes = interp->boundaryEdgeGiveNodes(edge, e->giveGeometryType()); int order = interp->giveInterpolationOrder(); - std :: unique_ptr< IntegrationRule > ir( interp->giveBoundaryEdgeIntegrationRule(order, edge) ); + std :: unique_ptr< IntegrationRule > ir( interp->giveBoundaryEdgeIntegrationRule(order, edge, e->giveGeometryType()) ); static_cast< TransportElement* >(e)->computeConstitutiveMatrixAt(D, Capacity, e->giveDefaultIntegrationRulePtr()->getIntegrationPoint(1), tStep); // Compute integral of B'*D*B and N: @@ -550,7 +550,7 @@ void TransportGradientDirichlet :: computeXi() FEInterpolation3d *interp = static_cast< FEInterpolation3d* >( e->giveInterpolation() ); int order = interp->giveInterpolationOrder(); - std :: unique_ptr< IntegrationRule > ir( interp->giveBoundaryIntegrationRule(order, surf) ); + std :: unique_ptr< IntegrationRule > ir( interp->giveBoundaryIntegrationRule(order, surf, e->giveGeometryType()) ); static_cast< TransportElement* >(e)->computeConstitutiveMatrixAt(D, Capacity, e->giveDefaultIntegrationRulePtr()->getIntegrationPoint(1), tStep); for ( auto &gp: *ir ) { @@ -585,7 +585,7 @@ void TransportGradientDirichlet :: computeXi() } Ke.symmetrized(); - const auto &bNodes = interp->boundaryGiveNodes(surf); + const auto &bNodes = interp->boundaryGiveNodes(surf, e->giveGeometryType()); IntArray loc(bNodes.giveSize()); FloatMatrix cvec(bNodes.giveSize(), 3); for ( int i = 1; i <= bNodes.giveSize(); ++i ) { diff --git a/src/tm/BoundaryCondition/transportgradientneumann.C b/src/tm/BoundaryCondition/transportgradientneumann.C index 957231872..8dd0b47f3 100644 --- a/src/tm/BoundaryCondition/transportgradientneumann.C +++ b/src/tm/BoundaryCondition/transportgradientneumann.C @@ -178,7 +178,7 @@ void TransportGradientNeumann :: assembleVector(FloatArray &answer, TimeStep *tS int boundary = boundaries[pos * 2 + 1]; // Fetch the element information; - const auto &bNodes = e->giveInterpolation()->boundaryGiveNodes(boundary); + const auto &bNodes = e->giveInterpolation()->boundaryGiveNodes(boundary, e->giveGeometryType()); e->giveBoundaryLocationArray(loc, bNodes, this->dofs, s, & masterDofIDs); e->computeBoundaryVectorOf(bNodes, this->dofs, mode, tStep, e_u); this->integrateTangent(Ke, e, boundary, i, pos); @@ -228,7 +228,7 @@ void TransportGradientNeumann :: assemble(SparseMtrx &answer, TimeStep *tStep, Element *e = this->giveDomain()->giveElement( boundaries[pos * 2] ); int boundary = boundaries[pos * 2 + 1]; - const auto &bNodes = e->giveInterpolation()->boundaryGiveNodes(boundary); + const auto &bNodes = e->giveInterpolation()->boundaryGiveNodes(boundary, e->giveGeometryType()); e->giveBoundaryLocationArray(loc_r, bNodes, this->dofs, r_s); e->giveBoundaryLocationArray(loc_c, bNodes, this->dofs, c_s); @@ -273,7 +273,7 @@ void TransportGradientNeumann :: giveLocationArrays(std :: vector< IntArray > &r Element *e = this->giveDomain()->giveElement( boundaries[pos * 2] ); int boundary = boundaries[pos * 2 + 1]; - const auto &bNodes = e->giveInterpolation()->boundaryGiveNodes(boundary); + const auto &bNodes = e->giveInterpolation()->boundaryGiveNodes(boundary, e->giveGeometryType()); e->giveBoundaryLocationArray(loc_r, bNodes, this->dofs, r_s); e->giveBoundaryLocationArray(loc_c, bNodes, this->dofs, c_s); @@ -358,7 +358,7 @@ void TransportGradientNeumann :: computeTangent(FloatMatrix &tangent, TimeStep * Element *e = this->giveDomain()->giveElement( boundaries[pos * 2] ); int boundary = boundaries[pos * 2 + 1]; - const auto &bNodes = e->giveInterpolation()->boundaryGiveNodes(boundary); + const auto &bNodes = e->giveInterpolation()->boundaryGiveNodes(boundary, e->giveGeometryType()); e->giveBoundaryLocationArray(loc_r, bNodes, this->dofs, fnum); this->integrateTangent(Ke, e, boundary, i, pos); @@ -474,7 +474,7 @@ void TransportGradientNeumann :: computeEta() FEInterpolation *interp = e->giveInterpolation(); // Geometry interpolation int order = interp->giveInterpolationOrder(); - std :: unique_ptr< IntegrationRule > ir( interp->giveBoundaryIntegrationRule(order, boundary) ); + std :: unique_ptr< IntegrationRule > ir( interp->giveBoundaryIntegrationRule(order, boundary, e->giveGeometryType()) ); static_cast< TransportElement* >(e)->computeConstitutiveMatrixAt(d, Capacity, e->giveDefaultIntegrationRulePtr()->getIntegrationPoint(1), tStep); for ( auto &gp: *ir ) { @@ -516,7 +516,7 @@ void TransportGradientNeumann :: computeEta() FEInterpolation *interp = e->giveInterpolation(); // Geometry interpolation int order = interp->giveInterpolationOrder(); - std :: unique_ptr< IntegrationRule > ir( interp->giveBoundaryIntegrationRule(order, boundary) ); + std :: unique_ptr< IntegrationRule > ir( interp->giveBoundaryIntegrationRule(order, boundary, e->giveGeometryType()) ); static_cast< TransportElement* >(e)->computeConstitutiveMatrixAt(d, Capacity, e->giveDefaultIntegrationRulePtr()->getIntegrationPoint(1), tStep); eta[i][pos].resize(ir->giveNumberOfIntegrationPoints()); @@ -549,7 +549,7 @@ void TransportGradientNeumann :: integrateTangent(FloatMatrix &oTangent, Element //FEInterpolation *interpUnknown = e->giveInterpolation(this->dofs[0]); int order = interp->giveInterpolationOrder(); - std :: unique_ptr< IntegrationRule > ir( interp->giveBoundaryIntegrationRule(order, boundary) ); + std :: unique_ptr< IntegrationRule > ir( interp->giveBoundaryIntegrationRule(order, boundary, e->giveGeometryType()) ); oTangent.clear(); diff --git a/src/tm/Elements/LatticeElements/lattice3d_mt.C b/src/tm/Elements/LatticeElements/lattice3d_mt.C index 523ada527..129efc5eb 100644 --- a/src/tm/Elements/LatticeElements/lattice3d_mt.C +++ b/src/tm/Elements/LatticeElements/lattice3d_mt.C @@ -180,7 +180,7 @@ Lattice3d_mt :: initializeFrom(InputRecord &ir) polygonCoords.resize(0); IR_GIVE_OPTIONAL_FIELD(ir, polygonCoords, _IFT_Lattice3DMT_polycoords); - numberOfPolygonVertices = polygonCoords.giveSize() / 3.; + numberOfPolygonVertices = (int) (polygonCoords.giveSize() / 3.); crackWidths.resize(numberOfPolygonVertices); crackWidths.zero(); diff --git a/src/tm/Elements/brick1_ht.h b/src/tm/Elements/brick1_ht.h index a757141e7..5b17a5fbf 100644 --- a/src/tm/Elements/brick1_ht.h +++ b/src/tm/Elements/brick1_ht.h @@ -69,6 +69,8 @@ class Brick1_ht : public TransportElement, public SpatialLocalizerInterface, pub int computeNumberOfDofs() override { return 8; } void initializeFrom(InputRecord &ir) override; MaterialMode giveMaterialMode() override { return _3dHeat; } + Element_Geometry_Type giveGeometryType() const override {return EGT_hexa_1;} + Interface *giveInterface(InterfaceType t) override; int testElementExtension(ElementExtension ext) override diff --git a/src/tm/Elements/line1_ht.h b/src/tm/Elements/line1_ht.h index 2e9e31c3d..47c0989fe 100644 --- a/src/tm/Elements/line1_ht.h +++ b/src/tm/Elements/line1_ht.h @@ -66,6 +66,8 @@ class Line1_ht : public TransportElement, public SpatialLocalizerInterface, publ int computeNumberOfDofs() override { return ( emode == HeatMass1TransferEM ) ? 4 : 2; } void initializeFrom(InputRecord &ir) override; MaterialMode giveMaterialMode() override { return _3dHeat; } + Element_Geometry_Type giveGeometryType() const override {return EGT_line_1;} + Interface *giveInterface(InterfaceType t) override; diff --git a/src/tm/Elements/qbrick1_ht.h b/src/tm/Elements/qbrick1_ht.h index d97d43ed6..14a835129 100644 --- a/src/tm/Elements/qbrick1_ht.h +++ b/src/tm/Elements/qbrick1_ht.h @@ -71,6 +71,8 @@ class QBrick1_ht : public TransportElement, public SpatialLocalizerInterface, pu int computeNumberOfDofs() override { return ( emode == HeatTransferEM ) ? 20 : 40; } void initializeFrom(InputRecord &ir) override; MaterialMode giveMaterialMode() override { return _3dHeat; } + Element_Geometry_Type giveGeometryType() const override {return EGT_hexa_2;} + Interface *giveInterface(InterfaceType t) override; int testElementExtension(ElementExtension ext) override { return ( ( ext == Element_SurfaceLoadSupport ) ? 1 : 0 ); } diff --git a/src/tm/Elements/qquad1_ht.h b/src/tm/Elements/qquad1_ht.h index 352e7ae3b..2d8bcd552 100644 --- a/src/tm/Elements/qquad1_ht.h +++ b/src/tm/Elements/qquad1_ht.h @@ -64,6 +64,8 @@ class QQuad1_ht : public TransportElement, public SpatialLocalizerInterface, pub const char *giveInputRecordName() const override { return _IFT_QQuad1_ht_Name; } const char *giveClassName() const override { return "QQuad1_ht"; } + Element_Geometry_Type giveGeometryType() const override {return EGT_quad_2;} + int computeNumberOfDofs() override { return 4; } void initializeFrom(InputRecord &ir) override; diff --git a/src/tm/Elements/quad1_ht.h b/src/tm/Elements/quad1_ht.h index dd5c99aa6..6dbc122cf 100644 --- a/src/tm/Elements/quad1_ht.h +++ b/src/tm/Elements/quad1_ht.h @@ -62,6 +62,8 @@ class Quad1_ht : public TransportElement, public SpatialLocalizerInterface, publ const char *giveInputRecordName() const override { return _IFT_Quad1_ht_Name; } const char *giveClassName() const override { return "Quad1_ht"; } + Element_Geometry_Type giveGeometryType() const override {return EGT_quad_1;} + //int computeNumberOfDofs() override { return ( emode == HeatTransferEM ) ? 4 : 8; } int computeNumberOfDofs() override { return 4; } diff --git a/src/tm/Elements/quadaxisym1_ht.C b/src/tm/Elements/quadaxisym1_ht.C index 25d364c09..07ddd8625 100644 --- a/src/tm/Elements/quadaxisym1_ht.C +++ b/src/tm/Elements/quadaxisym1_ht.C @@ -100,12 +100,12 @@ QuadAxisym1_ht :: computeRadiusAt(GaussPoint *gp) std::unique_ptr QuadAxisym1_ht :: giveBoundaryEdgeIntegrationRule(int order, int boundary) { - return this->giveInterpolation()->giveBoundaryEdgeIntegrationRule(order+1, boundary); + return this->giveInterpolation()->giveBoundaryEdgeIntegrationRule(order+1, boundary, this->giveGeometryType()); } std::unique_ptr QuadAxisym1_ht :: giveBoundarySurfaceIntegrationRule(int order, int boundary) { - return this->giveInterpolation()->giveBoundarySurfaceIntegrationRule(order+1, boundary); + return this->giveInterpolation()->giveBoundarySurfaceIntegrationRule(order+1, boundary, this->giveGeometryType()); } } // end namespace oofem diff --git a/src/tm/Elements/qwedge_ht.h b/src/tm/Elements/qwedge_ht.h index ea330b7fc..8b6cf0072 100644 --- a/src/tm/Elements/qwedge_ht.h +++ b/src/tm/Elements/qwedge_ht.h @@ -69,6 +69,8 @@ class FEI3dWedgeQuad; // definition & identification const char *giveInputRecordName() const override { return _IFT_QWedge_ht_Name; } const char *giveClassName() const override { return "QWedge_ht"; } + Element_Geometry_Type giveGeometryType() const override {return EGT_wedge_2;} + int computeNumberOfDofs() override { return 15; } void initializeFrom(InputRecord &ir) override; diff --git a/src/tm/Elements/tetrah1_ht.h b/src/tm/Elements/tetrah1_ht.h index cf0a27c2b..8c9d3a561 100644 --- a/src/tm/Elements/tetrah1_ht.h +++ b/src/tm/Elements/tetrah1_ht.h @@ -63,6 +63,8 @@ class Tetrah1_ht : public TransportElement, public SpatialLocalizerInterface, pu // definition const char *giveInputRecordName() const override { return _IFT_Tetrah1_ht_Name; } const char *giveClassName() const override { return "Tetrah1_ht"; } + Element_Geometry_Type giveGeometryType() const override {return EGT_tetra_1;} + int computeNumberOfDofs() override { return ( emode == HeatTransferEM ) ? 4 : 8; } void initializeFrom(InputRecord &ir) override; diff --git a/src/tm/Elements/tr1_ht.h b/src/tm/Elements/tr1_ht.h index f3e43f2ae..6e310ca8f 100644 --- a/src/tm/Elements/tr1_ht.h +++ b/src/tm/Elements/tr1_ht.h @@ -63,6 +63,8 @@ class Tr1_ht : public TransportElement, public SpatialLocalizerInterface, public // definition const char *giveInputRecordName() const override { return _IFT_Tr1_ht_Name; } const char *giveClassName() const override { return "Tr1_htElement"; } + Element_Geometry_Type giveGeometryType() const override {return EGT_triangle_1;} + int computeNumberOfDofs() override { return ( emode == HeatMass1TransferEM ) ? 6 : 3; } void initializeFrom(InputRecord &ir) override; diff --git a/src/tm/Elements/tr1darcy.h b/src/tm/Elements/tr1darcy.h index e818b4ea9..bdc8f63e5 100644 --- a/src/tm/Elements/tr1darcy.h +++ b/src/tm/Elements/tr1darcy.h @@ -61,6 +61,8 @@ class Tr1Darcy : public TransportElement, public NodalAveragingRecoveryModelInte FEInterpolation *giveInterpolation() const override; MaterialMode giveMaterialMode() override { return _2dHeat; } ///@todo This isn't actually correct. + Element_Geometry_Type giveGeometryType() const override {return EGT_triangle_1;} + void giveDofManDofIDMask(int inode, IntArray &answer) const override; void giveCharacteristicVector(FloatArray &answer, CharType mtrx, ValueModeType mode, TimeStep *tStep) override; diff --git a/src/tm/Elements/transportelement.C b/src/tm/Elements/transportelement.C index dacfe2fe3..be97766c4 100644 --- a/src/tm/Elements/transportelement.C +++ b/src/tm/Elements/transportelement.C @@ -572,7 +572,7 @@ TransportElement :: computeLoadVector(FloatArray &answer, BodyLoad *load, CharTy ///@todo Deal with coupled fields (I think they should be another class of problems completely). FEInterpolation *interp = this->giveInterpolation(); - std :: unique_ptr< IntegrationRule > iRule( interp->giveIntegrationRule( load->giveApproxOrder() + 1 + interp->giveInterpolationOrder()) ); + std :: unique_ptr< IntegrationRule > iRule( interp->giveIntegrationRule( load->giveApproxOrder() + 1 + interp->giveInterpolationOrder(), this->giveGeometryType()) ); if ( load->giveType() == ConvectionBC || load->giveType() == RadiationBC ) { this->computeVectorOf(dofid, VM_TotalIntrinsic, tStep, unknowns); @@ -621,7 +621,7 @@ TransportElement :: computeBoundarySurfaceLoadVector(FloatArray &answer, Boundar std :: unique_ptr< IntegrationRule > iRule( this->giveBoundarySurfaceIntegrationRule(load->giveApproxOrder() + interp->giveInterpolationOrder(), boundary) ); if ( load->giveType() == ConvectionBC || load->giveType() == RadiationBC ) { - const auto &bNodes = interp->boundaryGiveNodes(boundary); + const auto &bNodes = interp->boundaryGiveNodes(boundary, this->giveGeometryType()); this->computeBoundaryVectorOf(bNodes, dofid, VM_TotalIntrinsic, tStep, unknowns); } @@ -638,7 +638,7 @@ TransportElement :: computeBoundarySurfaceLoadVector(FloatArray &answer, Boundar //Check external ambient temperature field first FieldPtr tf; - if (tf = domain->giveEngngModel()->giveContext()->giveFieldManager()->giveField(FT_TemperatureAmbient)){ + if ((tf = domain->giveEngngModel()->giveContext()->giveFieldManager()->giveField(FT_TemperatureAmbient))){ tf->evaluateAt(val, gcoords, VM_TotalIntrinsic, tStep); } else if ( load->giveFormulationType() == Load :: FT_Entity ) { load->computeValueAt(val, tStep, lcoords, mode); @@ -695,7 +695,7 @@ TransportElement :: computeTangentFromSurfaceLoad(FloatMatrix &answer, SurfaceLo OOFEM_ERROR("Load property multexpr not implemented for coupled fields"); } IntArray dofid; - const auto &bNodes = interp->boundaryGiveNodes(boundary); + const auto &bNodes = interp->boundaryGiveNodes(boundary, this->giveGeometryType()); this->giveElementDofIDMask(dofid); this->computeBoundaryVectorOf(bNodes, dofid, VM_TotalIntrinsic, tStep, unknowns); } @@ -744,7 +744,7 @@ TransportElement :: computeTangentFromEdgeLoad(FloatMatrix &answer, EdgeLoad *lo if ( load->propertyMultExpr.isDefined() ) { IntArray dofid; this->giveElementDofIDMask(dofid); - const auto &bNodes = interp->boundaryEdgeGiveNodes(boundary); + const auto &bNodes = interp->boundaryEdgeGiveNodes(boundary, this->giveGeometryType()); this->giveElementDofIDMask(dofid); this->computeBoundaryVectorOf(bNodes, dofid, VM_TotalIntrinsic, tStep, unknowns); } @@ -806,7 +806,7 @@ TransportElement :: computeBoundaryEdgeLoadVector(FloatArray &answer, BoundaryLo if ( load->giveType() == ConvectionBC || load->giveType() == RadiationBC ) { IntArray dofid; this->giveElementDofIDMask(dofid); - const auto &bNodes = interp->boundaryEdgeGiveNodes(boundary); + const auto &bNodes = interp->boundaryEdgeGiveNodes(boundary, this->giveGeometryType()); this->computeBoundaryVectorOf(bNodes, dofid, VM_TotalIntrinsic, tStep, unknowns); } @@ -956,7 +956,7 @@ TransportElement :: computeBodyBCSubVectorAt(FloatArray &answer, Load *load, FloatArray val, globalIPcoords, n; answer.resize( this->giveNumberOfDofManagers() ); - std :: unique_ptr< IntegrationRule > iRule( this->giveInterpolation()->giveIntegrationRule(load->giveApproxOrder()) ); + std :: unique_ptr< IntegrationRule > iRule( this->giveInterpolation()->giveIntegrationRule(load->giveApproxOrder(), this->giveGeometryType()) ); for ( GaussPoint *gp : *iRule ) { double dV = this->computeVolumeAround(gp); this->computeNAt( n, gp->giveNaturalCoordinates() ); @@ -1016,7 +1016,7 @@ TransportElement :: computeEdgeBCSubVectorAt(FloatArray &answer, Load *load, int FieldPtr tf; FloatArray gcoords; - if (tf = domain->giveEngngModel()->giveContext()->giveFieldManager()->giveField(FT_TemperatureAmbient)){ + if ((tf = domain->giveEngngModel()->giveContext()->giveFieldManager()->giveField(FT_TemperatureAmbient))){ //this->computeEdgeIpGlobalCoords(gcoords, lcoords, iEdge); this->giveInterpolation()->boundaryEdgeLocal2Global( gcoords, iEdge, lcoords, FEIElementGeometryWrapper(this) ); diff --git a/src/tm/Elements/traxisym1_ht.h b/src/tm/Elements/traxisym1_ht.h index 1e12e4a2f..467c6d6f9 100644 --- a/src/tm/Elements/traxisym1_ht.h +++ b/src/tm/Elements/traxisym1_ht.h @@ -53,6 +53,8 @@ class TrAxisym1_ht : public Tr1_ht double computeVolumeAround(GaussPoint *gp) override; const char *giveInputRecordName() const override { return _IFT_TrAxisym1_ht_Name; } const char *giveClassName() const override { return "TrAxisym1_htElement"; } + Element_Geometry_Type giveGeometryType() const override {return EGT_triangle_1;} + double giveThicknessAt(const FloatArray &gcoords) override; diff --git a/src/tm/Elements/wedge_ht.h b/src/tm/Elements/wedge_ht.h index d0ce61440..e8ba8c717 100644 --- a/src/tm/Elements/wedge_ht.h +++ b/src/tm/Elements/wedge_ht.h @@ -65,6 +65,8 @@ class FEI3dWedgeLin; // definition & identification const char *giveInputRecordName() const override { return _IFT_Wedge_ht_Name; } const char *giveClassName() const override { return "Wedge_ht"; } + Element_Geometry_Type giveGeometryType() const override {return EGT_wedge_1;} + int computeNumberOfDofs() override { return 6; } void initializeFrom(InputRecord &ir) override; diff --git a/src/tm/EngineeringModels/nltransienttransportproblem.C b/src/tm/EngineeringModels/nltransienttransportproblem.C index 3ac255324..8fdfb7e96 100644 --- a/src/tm/EngineeringModels/nltransienttransportproblem.C +++ b/src/tm/EngineeringModels/nltransienttransportproblem.C @@ -231,27 +231,27 @@ double NLTransientTransportProblem :: giveUnknownComponent(ValueModeType mode, T } double t = tStep->giveTargetTime(); - TimeStep *previousStep = this->givePreviousStep(), *currentStep = this->giveCurrentStep(); + TimeStep *pStep = this->givePreviousStep(), *cStep = this->giveCurrentStep(); if ( dof->__giveEquationNumber() == 0 ) { OOFEM_ERROR("invalid equation number on DoF %d", dof->giveDofID() ); } - if ( ( t >= previousStep->giveTargetTime() ) && ( t <= currentStep->giveTargetTime() ) ) { + if ( ( t >= pStep->giveTargetTime() ) && ( t <= cStep->giveTargetTime() ) ) { ///@todo Shouldn't it be enough to just run this? - //UnknownsField->giveUnknownValue(dof, mode, currentStep); - double rtdt = UnknownsField->giveUnknownValue(dof, VM_Total, currentStep); - double rt = UnknownsField->giveUnknownValue(dof, VM_Total, previousStep); - double psi = ( t - previousStep->giveTargetTime() ) / currentStep->giveTimeIncrement(); + //UnknownsField->giveUnknownValue(dof, mode, cStep); + double rtdt = UnknownsField->giveUnknownValue(dof, VM_Total, cStep); + double rt = UnknownsField->giveUnknownValue(dof, VM_Total, pStep); + double psi = ( t - pStep->giveTargetTime() ) / cStep->giveTimeIncrement(); if ( mode == VM_Velocity ) { - return ( rtdt - rt ) / currentStep->giveTimeIncrement(); + return ( rtdt - rt ) / cStep->giveTimeIncrement(); } else if ( mode == VM_TotalIntrinsic ) { // only supported for current step return this->alpha * rtdt + ( 1. - this->alpha ) * rt; } else if ( mode == VM_Total ) { return psi * rtdt + ( 1. - psi ) * rt; } else if ( mode == VM_Incremental ) { - if ( previousStep->isIcApply() ) { + if ( pStep->isIcApply() ) { return 0; } else { return ( rtdt - rt ); @@ -260,7 +260,7 @@ double NLTransientTransportProblem :: giveUnknownComponent(ValueModeType mode, T OOFEM_ERROR("Unknown mode %s is undefined for this problem", __ValueModeTypeToString(mode) ); } } else { - OOFEM_ERROR("time value %f not within bounds %f and %f", t, previousStep->giveTargetTime(), currentStep->giveTargetTime() ); + OOFEM_ERROR("time value %f not within bounds %f and %f", t, pStep->giveTargetTime(), cStep->giveTargetTime() ); } return 0.; // to make compiler happy; @@ -268,17 +268,17 @@ double NLTransientTransportProblem :: giveUnknownComponent(ValueModeType mode, T void -NLTransientTransportProblem :: applyIC(TimeStep *stepWhenIcApply) +NLTransientTransportProblem :: applyIC(TimeStep *_stepWhenIcApply) { Domain *domain = this->giveDomain(1); - NonStationaryTransportProblem :: applyIC(stepWhenIcApply); + NonStationaryTransportProblem :: applyIC(_stepWhenIcApply); // update element state according to given ic for ( auto &elem : domain->giveElements() ) { TransportElement *element = static_cast< TransportElement * >( elem.get() ); - element->updateInternalState(stepWhenIcApply); - element->updateYourself(stepWhenIcApply); + element->updateInternalState(_stepWhenIcApply); + element->updateYourself(_stepWhenIcApply); } } @@ -326,8 +326,6 @@ NLTransientTransportProblem :: giveUnknownDictHashIndx(ValueModeType mode, TimeS } else { OOFEM_ERROR("ValueModeType %s undefined", __ValueModeTypeToString(mode)); } - - return 0; } void @@ -379,8 +377,8 @@ NLTransientTransportProblem :: assembleAlgorithmicPartOfRhs(FloatArray &answer, FloatMatrix charMtrxCond, charMtrxCap; FloatArray r, drdt, contrib, help; Element *element; - TimeStep *previousStep = this->givePreviousStep(); //r_t - TimeStep *currentStep = this->giveCurrentStep(); //r_{t+\Delta t}. Note that *tStep is a Tau step between r_t and r_{t+\Delta t} + TimeStep *pStep = this->givePreviousStep(); //r_t + TimeStep *cStep = this->giveCurrentStep(); //r_{t+\Delta t}. Note that *tStep is a Tau step between r_t and r_{t+\Delta t} Domain *domain = this->giveDomain(1); int nelem = domain->giveNumberOfElements(); @@ -409,14 +407,14 @@ NLTransientTransportProblem :: assembleAlgorithmicPartOfRhs(FloatArray &answer, * element -> computeVectorOf (VM_Velocity, tStep, drdt); */ - if ( ( t >= previousStep->giveTargetTime() ) && ( t <= currentStep->giveTargetTime() ) ) { + if ( ( t >= pStep->giveTargetTime() ) && ( t <= cStep->giveTargetTime() ) ) { FloatArray rp, rc; - element->computeVectorOf(VM_Total, currentStep, rc); - element->computeVectorOf(VM_Total, previousStep, rp); + element->computeVectorOf(VM_Total, cStep, rc); + element->computeVectorOf(VM_Total, pStep, rp); //approximate derivative with a difference drdt.beDifferenceOf(rc, rp); - drdt.times( 1. / currentStep->giveTimeIncrement() ); + drdt.times( 1. / cStep->giveTimeIncrement() ); //approximate current solution from linear interpolation rp.times(1 - alpha); rc.times(alpha); diff --git a/src/tm/EngineeringModels/nonstationarytransportproblem.C b/src/tm/EngineeringModels/nonstationarytransportproblem.C index 255269689..7ba871a3c 100644 --- a/src/tm/EngineeringModels/nonstationarytransportproblem.C +++ b/src/tm/EngineeringModels/nonstationarytransportproblem.C @@ -237,7 +237,6 @@ NonStationaryTransportProblem :: giveDiscreteTime(int iStep) } OOFEM_ERROR("invalid iStep"); - return 0.0; } @@ -508,8 +507,6 @@ NonStationaryTransportProblem :: giveUnknownDictHashIndx(ValueModeType mode, Tim } else { OOFEM_ERROR("ValueModeType %s undefined", __ValueModeTypeToString(mode)); } - - return 0; } @@ -552,7 +549,7 @@ NonStationaryTransportProblem :: assembleAlgorithmicPartOfRhs(FloatArray &answer void -NonStationaryTransportProblem :: applyIC(TimeStep *stepWhenIcApply) +NonStationaryTransportProblem :: applyIC(TimeStep *_stepWhenIcApply) { Domain *domain = this->giveDomain(1); int neq = this->giveNumberOfDomainEquations( 1, EModelDefaultEquationNumbering() ); @@ -563,8 +560,8 @@ NonStationaryTransportProblem :: applyIC(TimeStep *stepWhenIcApply) OOFEM_LOG_INFO("Applying initial conditions\n"); #endif - UnknownsField->advanceSolution(stepWhenIcApply); - solutionVector = UnknownsField->giveSolutionVector(stepWhenIcApply); + UnknownsField->advanceSolution(_stepWhenIcApply); + solutionVector = UnknownsField->giveSolutionVector(_stepWhenIcApply); solutionVector->resize(neq); solutionVector->zero(); @@ -579,11 +576,11 @@ NonStationaryTransportProblem :: applyIC(TimeStep *stepWhenIcApply) int jj = dof->__giveEquationNumber(); if ( jj ) { - val = dof->giveUnknown(VM_Total, stepWhenIcApply); + val = dof->giveUnknown(VM_Total, _stepWhenIcApply); solutionVector->at(jj) = val; //update in dictionary, if the problem is growing/decreasing if ( this->changingProblemSize ) { - dof->updateUnknownsDictionary(stepWhenIcApply, VM_Total, val); + dof->updateUnknownsDictionary(_stepWhenIcApply, VM_Total, val); } } } @@ -593,7 +590,7 @@ NonStationaryTransportProblem :: applyIC(TimeStep *stepWhenIcApply) //project initial temperature to integration points // for ( int j = 1; j <= nelem; j++ ) { - // domain->giveElement(j)->updateInternalState(stepWhenIcApply); + // domain->giveElement(j)->updateInternalState(_stepWhenIcApply); // } #ifdef __CEMHYD_MODULE @@ -605,10 +602,10 @@ NonStationaryTransportProblem :: applyIC(TimeStep *stepWhenIcApply) //assign status to each integration point on each element if ( cem ) { cem->initMaterial(element); //create microstructures and statuses on specific GPs - element->updateInternalState(stepWhenIcApply); //store temporary unequilibrated temperature - element->updateYourself(stepWhenIcApply); //store equilibrated temperature + element->updateInternalState(_stepWhenIcApply); //store temporary unequilibrated temperature + element->updateYourself(_stepWhenIcApply); //store equilibrated temperature cem->clearWeightTemperatureProductVolume(element); - cem->storeWeightTemperatureProductVolume(element, stepWhenIcApply); + cem->storeWeightTemperatureProductVolume(element, _stepWhenIcApply); } } @@ -625,8 +622,8 @@ NonStationaryTransportProblem :: applyIC(TimeStep *stepWhenIcApply) // update element state according to given ic for ( auto &elem : domain->giveElements() ) { TransportElement *element = static_cast< TransportElement * >( elem.get() ); - element->updateInternalState(stepWhenIcApply); - element->updateYourself(stepWhenIcApply); + element->updateInternalState(_stepWhenIcApply); + element->updateYourself(_stepWhenIcApply); } } diff --git a/src/tm/EngineeringModels/stationarytransportproblem.C b/src/tm/EngineeringModels/stationarytransportproblem.C index 740f33e95..aab7789cf 100644 --- a/src/tm/EngineeringModels/stationarytransportproblem.C +++ b/src/tm/EngineeringModels/stationarytransportproblem.C @@ -236,11 +236,11 @@ StationaryTransportProblem :: updateSolution(FloatArray &solutionVector, TimeSte void -StationaryTransportProblem :: updateInternalRHS(FloatArray &answer, TimeStep *tStep, Domain *d, FloatArray *eNorm) +StationaryTransportProblem :: updateInternalRHS(FloatArray &answer, TimeStep *tStep, Domain *d, FloatArray *enorm) { answer.zero(); this->assembleVector(answer, tStep, InternalForceAssembler(), VM_Total, - EModelDefaultEquationNumbering(), this->giveDomain(1), eNorm); + EModelDefaultEquationNumbering(), this->giveDomain(1), enorm); this->updateSharedDofManagers(answer, EModelDefaultEquationNumbering(), InternalForcesExchangeTag); } diff --git a/src/tm/EngineeringModels/transienttransportproblem.C b/src/tm/EngineeringModels/transienttransportproblem.C index c5e166e69..9df2827fa 100644 --- a/src/tm/EngineeringModels/transienttransportproblem.C +++ b/src/tm/EngineeringModels/transienttransportproblem.C @@ -149,7 +149,6 @@ TransientTransportProblem :: giveDiscreteTime(int iStep) } OOFEM_ERROR("invalid iStep"); - return 0.0; } diff --git a/src/tm/Materials/LatticeMaterials/latticetransmat.C b/src/tm/Materials/LatticeMaterials/latticetransmat.C index b70b8eb5e..1dbf56281 100644 --- a/src/tm/Materials/LatticeMaterials/latticetransmat.C +++ b/src/tm/Materials/LatticeMaterials/latticetransmat.C @@ -144,7 +144,7 @@ LatticeTransportMaterial :: giveCharacteristicValue(MatResponseMode mode, OOFEM_ERROR("unknown mode"); } - return 0; // to make compiler happy + //return 0; // to make compiler happy } diff --git a/src/tm/Materials/LatticeMaterials/latticetransmat.h b/src/tm/Materials/LatticeMaterials/latticetransmat.h index 75f8aa322..42312d828 100644 --- a/src/tm/Materials/LatticeMaterials/latticetransmat.h +++ b/src/tm/Materials/LatticeMaterials/latticetransmat.h @@ -119,10 +119,10 @@ class LatticeTransportMaterial : public TransportMaterial double density = 0.; /// Type of conductivity and capcity laws. - int conType = 0.; + int conType = 0; /// Type of conductivity and capcity laws. - int capacity = 0.; + int capacity = 0; /// Relative saturated water content double thetaS = 0.; diff --git a/src/tm/Materials/anisomassmat.C b/src/tm/Materials/anisomassmat.C index c9a207d29..ca5de7427 100644 --- a/src/tm/Materials/anisomassmat.C +++ b/src/tm/Materials/anisomassmat.C @@ -80,7 +80,5 @@ double AnisotropicMassTransferMaterial :: giveCharacteristicValue(MatResponseMode mode, GaussPoint *gp, TimeStep *tStep) const { OOFEM_ERROR("unknown mode (%s)", __MatResponseModeToString(mode) ); - - return 0.; } } // end namespace oofem diff --git a/src/tm/Materials/hemobaznajmat.C b/src/tm/Materials/hemobaznajmat.C index cd6c2771c..a4afe1199 100644 --- a/src/tm/Materials/hemobaznajmat.C +++ b/src/tm/Materials/hemobaznajmat.C @@ -143,7 +143,6 @@ double HeMoBazNajMaterial :: computeCapacityCoeff(MatResponseMode mode, GaussPoi } else { OOFEM_ERROR("Unknown MatResponseMode"); - return 0.; } } @@ -181,7 +180,7 @@ HeMoBazNajMaterial :: isCharacteristicMtrxSymmetric(MatResponseMode mode) const OOFEM_ERROR( "isCharacteristicMtrxSymmetric : unknown mode (%s)", __MatResponseModeToString(mode) ); } - return false; // to make compiler happy + // return false; // to make compiler happy } int diff --git a/src/tm/Materials/hemokunzelmat.C b/src/tm/Materials/hemokunzelmat.C index 474555263..edccc1545 100644 --- a/src/tm/Materials/hemokunzelmat.C +++ b/src/tm/Materials/hemokunzelmat.C @@ -222,7 +222,7 @@ double HeMoKunzelMaterial :: computeCapacityCoeff(MatResponseMode mode, GaussPoi OOFEM_ERROR("Unknown MatResponseMode"); } - return 0.0; // to make compiler happy + // return 0.0; // to make compiler happy } @@ -239,7 +239,6 @@ HeMoKunzelMaterial :: giveMoistureContent(double h) const return iso_wh * ( iso_b - 1. ) * h / ( iso_b - h ); } else { OOFEM_ERROR("Unknown Isotherm type"); - return 0.; } } @@ -256,7 +255,6 @@ HeMoKunzelMaterial :: giveMoistureContentDerivative(double h) const return iso_wh * ( iso_b - 1. ) * iso_b / ( ( iso_b - h ) * ( iso_b - h ) ); } else { OOFEM_ERROR("Unknown Isotherm type"); - return 0.; } } @@ -397,7 +395,7 @@ HeMoKunzelMaterial :: isCharacteristicMtrxSymmetric(MatResponseMode mode) const OOFEM_ERROR( "isCharacteristicMtrxSymmetric : unknown mode (%s)", __MatResponseModeToString(mode) ); } - return false; // to make compiler happy + // return false; // to make compiler happy } int diff --git a/src/tm/Materials/hemotkmat.C b/src/tm/Materials/hemotkmat.C index 2a7d13656..5a822c786 100644 --- a/src/tm/Materials/hemotkmat.C +++ b/src/tm/Materials/hemotkmat.C @@ -154,7 +154,7 @@ double HeMoTKMaterial :: computeCapacityCoeff(MatResponseMode mode, GaussPoint * OOFEM_ERROR("Unknown MatResponseMode"); } - return 0.0; // to make compiler happy + // return 0.0; // to make compiler happy } @@ -357,7 +357,7 @@ HeMoTKMaterial :: isCharacteristicMtrxSymmetric(MatResponseMode mode) const OOFEM_ERROR("unknown mode (%s)", __MatResponseModeToString(mode) ); } - return false; // to make compiler happy + // return false; // to make compiler happy } int diff --git a/src/tm/Materials/hydram.C b/src/tm/Materials/hydram.C index 2457a5b0b..0c6da63ee 100644 --- a/src/tm/Materials/hydram.C +++ b/src/tm/Materials/hydram.C @@ -303,7 +303,7 @@ HydrationModel :: computeInternalSourceVector(FloatArray &val, GaussPoint *gp, T } double -HydrationModel :: giveCharacteristicValue(double T, double h, MatResponseMode rmode, GaussPoint *gp, TimeStep *tStep) const +HydrationModel :: _giveCharacteristicValue(double T, double h, MatResponseMode rmode, GaussPoint *gp, TimeStep *tStep) const // Transport status needs to be obtained from master status, it's better to pass as a parameter // to enable usage from structural material { @@ -313,7 +313,7 @@ HydrationModel :: giveCharacteristicValue(double T, double h, MatResponseMode rm OOFEM_ERROR("wrong MatResponseMode."); } - return 0.; + // return 0.; } double diff --git a/src/tm/Materials/hydram.h b/src/tm/Materials/hydram.h index ccd12a386..3ba9895cf 100644 --- a/src/tm/Materials/hydram.h +++ b/src/tm/Materials/hydram.h @@ -260,7 +260,7 @@ class HydrationModel : public Material void computeInternalSourceVector(FloatArray &val, GaussPoint *gp, TimeStep *tStep, ValueModeType mode) const; // } end new 5.1.2004 /// Returns coefficients for LHS contribution from internal sources (dHeat/dT, dWaterSource/dw) for given temp state vector. - virtual double giveCharacteristicValue(double T, double h, MatResponseMode rmode, GaussPoint *gp, TimeStep *tStep) const; + virtual double _giveCharacteristicValue(double T, double h, MatResponseMode rmode, GaussPoint *gp, TimeStep *tStep) const; // --- identification and auxiliary functions --- const char *giveInputRecordName() const override { return _IFT_HydrationModel_Name; } const char *giveClassName() const override { return "HydrationModel"; } diff --git a/src/tm/Materials/hydratingconcretemat.C b/src/tm/Materials/hydratingconcretemat.C index 1dd1a0003..34e86e963 100644 --- a/src/tm/Materials/hydratingconcretemat.C +++ b/src/tm/Materials/hydratingconcretemat.C @@ -171,7 +171,7 @@ HydratingConcreteMat :: giveCharacteristicValue(MatResponseMode mode, GaussPoint OOFEM_ERROR("unknown mode (%s)\n", __MatResponseModeToString(mode) ); } - return 0.; + // return 0.; } @@ -181,12 +181,11 @@ double HydratingConcreteMat :: giveIsotropicConductivity(GaussPoint *gp, TimeSte double conduct; if ( conductivityType == 0 ) { //given from input file - conduct = IsotropicHeatTransferMaterial :: give('k', gp, tStep); + conduct = IsotropicHeatTransferMaterial :: giveProperty('k', gp, tStep); } else if ( conductivityType == 1 ) { //compute according to Ruiz, Schindler, Rasmussen. Kim, Chang: Concrete temperature modeling and strength prediction using maturity concepts in the FHWA HIPERPAV software, 7th international conference on concrete pavements, Orlando (FL), USA, 2001 - conduct = IsotropicHeatTransferMaterial :: give('k', gp, tStep) * ( 1.0 - 0.33 / 1.33 * ms->giveDoHActual() ); + conduct = IsotropicHeatTransferMaterial :: giveProperty('k', gp, tStep) * ( 1.0 - 0.33 / 1.33 * ms->giveDoHActual() ); } else { OOFEM_ERROR("Unknown conductivityType %d\n", conductivityType); - conduct = 0.; } //Parallel Voigt model, 20 W/m/K for steel @@ -205,13 +204,11 @@ double HydratingConcreteMat :: giveConcreteCapacity(GaussPoint *gp, TimeStep *tS double capacityConcrete; if ( capacityType == 0 ) { //given from OOFEM input file - capacityConcrete = IsotropicHeatTransferMaterial :: give('c', gp, tStep); + capacityConcrete = IsotropicHeatTransferMaterial :: giveProperty('c', gp, tStep); } else if ( capacityType == 1 ) { ////calculate from 5-component model OOFEM_ERROR("Calculate from 5-component model, not implemented in capacityType %d\n", capacityType); - capacityConcrete = 0.; } else { OOFEM_ERROR("Unknown capacityType %d\n", capacityType); - capacityConcrete = 0.; } //Parallel Voigt model, 500 J/kg/K for steel @@ -230,13 +227,11 @@ double HydratingConcreteMat :: giveConcreteDensity(GaussPoint *gp, TimeStep *tSt double concreteBulkDensity; if ( densityType == 0 ) { //get from input file - concreteBulkDensity = IsotropicHeatTransferMaterial :: give('d', gp, tStep); + concreteBulkDensity = IsotropicHeatTransferMaterial :: giveProperty('d', gp, tStep); } else if ( densityType == 1 ) { //calculate from 5-component model - not implemented OOFEM_ERROR("Calculate from 5-component model, not implemented in densityType %d\n", densityType); - concreteBulkDensity = 0.; } else { OOFEM_ERROR("Unknown densityType %d\n", densityType); - concreteBulkDensity = 0.; } //Parallel Voigt model, 7850 kg/m3 for steel diff --git a/src/tm/Materials/hydratinghemomat.C b/src/tm/Materials/hydratinghemomat.C index aece67788..042713315 100644 --- a/src/tm/Materials/hydratinghemomat.C +++ b/src/tm/Materials/hydratinghemomat.C @@ -211,7 +211,7 @@ HydratingHeMoMaterial :: giveCharacteristicValue(MatResponseMode rmode, GaussPoi double t = status->giveTempTemperature(); double h = status->giveTempHumidity(); h = inverse_sorption_isotherm( h ); // compute relative humidity - answer = hydrationModel->giveCharacteristicValue(t, h, rmode, gp, tStep) / tStep->giveTimeIncrement(); + answer = hydrationModel->_giveCharacteristicValue(t, h, rmode, gp, tStep) / tStep->giveTimeIncrement(); if ( rmode == IntSource_ww || rmode == IntSource_hw ) { answer *= give_dphi_dw( h ); } diff --git a/src/tm/Materials/hydratingisoheatmat.C b/src/tm/Materials/hydratingisoheatmat.C index 46483d8bf..58b36d605 100644 --- a/src/tm/Materials/hydratingisoheatmat.C +++ b/src/tm/Materials/hydratingisoheatmat.C @@ -159,7 +159,7 @@ HydratingIsoHeatMaterial :: updateInternalState(const FloatArray &vec, GaussPoin aux.zero(); } - aux.times( 1. / give('d', gp, tStep) ); + aux.times( 1. / giveProperty('d', gp, tStep) ); fprintf( vyst, "Elem %.3d krok %.2d: t= %.0f, dt=%.0f, %ld. it, ksi= %.12f, T= %.8f, heat=%.8f\n", gp->giveElement()->giveNumber(), tStep->giveNumber(), tStep->giveTargetTime(), tStep->giveTimeIncrement(), tStep->giveSolutionStateCounter(), giveHydrationDegree(gp, tStep, VM_Total), vec.at(1), aux.at(1) * tStep->giveTimeIncrement() ); @@ -174,9 +174,9 @@ HydratingIsoHeatMaterial :: giveCharacteristicValue(MatResponseMode rmode, Gauss { if ( rmode == Capacity ) { if ( castAt && ( tStep->giveTargetTime() < castAt ) ) { - return this->give('c', gp, tStep) * this->give('d', gp, tStep) / 1000; // Zero capacity before cast + return this->giveProperty('c', gp, tStep) * this->giveProperty('d', gp, tStep) / 1000; // Zero capacity before cast } else { - return this->give('c', gp, tStep) * this->give('d', gp, tStep); + return this->giveProperty('c', gp, tStep) * this->giveProperty('d', gp, tStep); } } else if ( !hydrationLHS ) { return 0; @@ -185,10 +185,9 @@ HydratingIsoHeatMaterial :: giveCharacteristicValue(MatResponseMode rmode, Gauss double t = status->giveTempTemperature(); double h = status->giveTempHumidity(); // TODO CHECK - return hydrationModel->giveCharacteristicValue(t, h, rmode, gp, tStep) / tStep->giveTimeIncrement(); + return hydrationModel->_giveCharacteristicValue(t, h, rmode, gp, tStep) / tStep->giveTimeIncrement(); } else { OOFEM_ERROR("unknown MatResponseMode (%s)", __MatResponseModeToString(rmode) ); - return 0.; } } diff --git a/src/tm/Materials/isoheatmat.C b/src/tm/Materials/isoheatmat.C index 3f7d25954..03648177c 100644 --- a/src/tm/Materials/isoheatmat.C +++ b/src/tm/Materials/isoheatmat.C @@ -57,7 +57,7 @@ IsotropicHeatTransferMaterial :: initializeFrom(InputRecord &ir) } double -IsotropicHeatTransferMaterial :: give(int aProperty, GaussPoint *gp, TimeStep *tStep) const +IsotropicHeatTransferMaterial :: giveProperty(int aProperty, GaussPoint *gp, TimeStep *tStep) const { if ( aProperty == 'k' ) { //thermal conductivity [W/m/K] return conductivity.eval( { { "te", giveTemperature(gp) }, { "t", tStep->giveIntrinsicTime() } }, this->giveDomain(), gp, giveTemperature(gp) ); @@ -66,7 +66,7 @@ IsotropicHeatTransferMaterial :: give(int aProperty, GaussPoint *gp, TimeStep *t } else if ( aProperty == 'd' && density.isDefined() ) { //density [kg/m3] return density.eval( { { "te", giveTemperature(gp) }, { "t", tStep->giveIntrinsicTime() } }, this->giveDomain(), gp, giveTemperature(gp) ); } else if ( aProperty == HeatCapaCoeff ) { //volume-specific heat capacity [J/m3/K] - return ( this->give('c', gp, tStep) * this->give('d', gp, tStep) ); + return ( this->giveProperty('c', gp, tStep) * this->giveProperty('d', gp, tStep) ); } return this->Material :: give(aProperty, gp); @@ -99,7 +99,7 @@ IsotropicHeatTransferMaterial :: computeTangent3D(MatResponseMode mode, GaussPoi double IsotropicHeatTransferMaterial :: giveIsotropicConductivity(GaussPoint *gp, TimeStep *tStep) const { - return give('k', gp, tStep); + return giveProperty('k', gp, tStep); } double @@ -108,12 +108,12 @@ IsotropicHeatTransferMaterial :: giveCharacteristicValue(MatResponseMode mode, TimeStep *tStep) const { if ( mode == Capacity ) { - return ( this->give('c', gp, tStep) * this->give('d', gp, tStep) ); + return ( this->giveProperty('c', gp, tStep) * this->giveProperty('d', gp, tStep) ); } else { OOFEM_ERROR("unknown mode (%s)", __MatResponseModeToString(mode) ); } - return 0.; + // return 0.; } @@ -130,16 +130,16 @@ IsotropicHeatTransferMaterial :: giveIPValue(FloatArray &answer, GaussPoint *gp, answer = FloatArray{ this->giveTemperature(gp) }; return 1; } else if ( type == IST_Density ) { - answer = FloatArray{ this->give('d', gp, tStep) }; + answer = FloatArray{ this->giveProperty('d', gp, tStep) }; return 1; } else if ( type == IST_HeatCapacity ) { - answer = FloatArray{ this->give('c', gp, tStep) }; + answer = FloatArray{ this->giveProperty('c', gp, tStep) }; return 1; } else if ( type == IST_ThermalConductivityIsotropic ) { - answer = FloatArray{ this->give('k', gp, tStep) }; + answer = FloatArray{ this->giveProperty('k', gp, tStep) }; return 1; } else if ( type == IST_EnergyMassCapacity ) { - answer = FloatArray{ this->give('c', gp, tStep) * this->give('d', gp, tStep) * this->giveTemperature(gp) }; + answer = FloatArray{ this->giveProperty('c', gp, tStep) * this->giveProperty('d', gp, tStep) * this->giveTemperature(gp) }; return 1; } diff --git a/src/tm/Materials/isoheatmat.h b/src/tm/Materials/isoheatmat.h index 98bcf6c90..57a49b079 100644 --- a/src/tm/Materials/isoheatmat.h +++ b/src/tm/Materials/isoheatmat.h @@ -85,7 +85,7 @@ class IsotropicHeatTransferMaterial : public TransportMaterial void initializeFrom(InputRecord &ir) override; - double give(int aProperty, GaussPoint *gp, TimeStep *tStep) const; + double giveProperty(int aProperty, GaussPoint *gp, TimeStep *tStep) const; double giveTemperature(GaussPoint *gp) const; }; diff --git a/src/tm/Materials/isomoisturemat.C b/src/tm/Materials/isomoisturemat.C index 5aa2d9b3f..49a74a12d 100644 --- a/src/tm/Materials/isomoisturemat.C +++ b/src/tm/Materials/isomoisturemat.C @@ -76,7 +76,7 @@ IsotropicMoistureTransferMaterial :: giveCharacteristicValue(MatResponseMode mod OOFEM_ERROR("unknown mode (%s)", __MatResponseModeToString(mode) ); } - return 0.; + // return 0.; } diff --git a/src/tm/Materials/nlisomoisturemat.C b/src/tm/Materials/nlisomoisturemat.C index 6931b4780..11ff073f8 100644 --- a/src/tm/Materials/nlisomoisturemat.C +++ b/src/tm/Materials/nlisomoisturemat.C @@ -427,7 +427,6 @@ NlIsoMoistureMaterial::giveHumidity(GaussPoint *gp, ValueModeType mode) const auto tempState = static_cast< TransportMaterialStatus * >( this->giveStatus(gp) )->giveTempField(); if ( tempState > 1.0 || tempState < 0.0 ) { OOFEM_ERROR("Relative humidity %.3f is out of range", tempState); - return 0.0; } else { return tempState; } diff --git a/src/tm/Materials/rvestokesflow.C b/src/tm/Materials/rvestokesflow.C index 198251d2f..381c04464 100644 --- a/src/tm/Materials/rvestokesflow.C +++ b/src/tm/Materials/rvestokesflow.C @@ -161,7 +161,7 @@ RVEStokesFlow :: giveIPValue(FloatArray &answer, GaussPoint *gp, InternalStateTy return TransportMaterial :: giveIPValue(answer, gp, type, tStep); } - return 0; + // return 0; } diff --git a/src/tm/Materials/transportmaterial.h b/src/tm/Materials/transportmaterial.h index 604ba3005..0ecc8b83b 100644 --- a/src/tm/Materials/transportmaterial.h +++ b/src/tm/Materials/transportmaterial.h @@ -234,7 +234,7 @@ class TransportMaterial : public Material virtual void giveCharacteristicMatrix(FloatMatrix &answer, MatResponseMode mode, GaussPoint *gp, - TimeStep *tStep) const; + TimeStep *tStep) const override; virtual FloatMatrixF<3,3> computeTangent3D(MatResponseMode mode, GaussPoint *gp, TimeStep *tStep) const = 0; FloatMatrixF<2,2> computeTangent2D(MatResponseMode mode, GaussPoint *gp, TimeStep *tStep) const; @@ -250,7 +250,7 @@ class TransportMaterial : public Material */ virtual double giveCharacteristicValue(MatResponseMode mode, GaussPoint *gp, - TimeStep *tStep) const = 0; + TimeStep *tStep) const override = 0; /** * Updates internal state of material according to new state vector. diff --git a/tests/benchmark/sm/concrete_3point_original.in b/tests/benchmark/sm/concrete_3point_original.in new file mode 100644 index 000000000..0bc842f4d --- /dev/null +++ b/tests/benchmark/sm/concrete_3point_original.in @@ -0,0 +1,1346 @@ +concrete_3point.out +Test: 3-point bending, triangular elements, 1 loaded point +StaticStructural nsteps 20 solverType "calm" stepLength 0.025 rtolf 1e-4 Psi 0.0 MaxIter 200 reqIterations 80 HPC 2 1 2 stiffmode 1 nmodules 1 +errorcheck +domain 2dPlaneStress +# +# zkracena verze vypoctu z me disertace +# +#Monitored 2 +#1 node 1 displacement 2 * +#2 node 1 force 2 * +#** +# +OutputManager tstep_all dofman_all element_all +ndofman 444 nelem 799 ncrosssect 2 nmat 2 nbc 3 nic 0 nltf 1 nset 5 +node 1 coords 2 1000.000000 500.000000 +node 2 coords 2 900.000000 0.000000 +node 3 coords 2 850.755859 0.000000 +node 4 coords 2 796.661743 0.000000 +node 5 coords 2 736.054993 0.000000 +node 6 coords 2 667.393921 0.000000 +node 7 coords 2 589.319580 0.000000 +node 8 coords 2 500.725708 0.000000 +node 9 coords 2 400.839996 0.000000 +node 10 coords 2 289.309998 0.000000 +node 11 coords 2 166.261612 0.000000 +node 12 coords 2 0.000000 0.000000 +node 13 coords 2 900.000000 500.000000 +node 14 coords 2 900.000000 475.552399 +node 15 coords 2 900.000000 451.711365 +node 16 coords 2 900.000000 428.109802 +node 17 coords 2 900.000000 404.331390 +node 18 coords 2 900.000000 380.010651 +node 19 coords 2 900.000000 354.926605 +node 20 coords 2 900.000000 329.090668 +node 21 coords 2 900.000000 302.784180 +node 22 coords 2 900.000000 276.469330 +node 23 coords 2 900.000000 250.563370 +node 24 coords 2 900.000000 225.213165 +node 25 coords 2 900.000000 200.219864 +node 26 coords 2 900.000000 175.101700 +node 27 coords 2 900.000000 149.182297 +node 28 coords 2 900.000000 121.635910 +node 29 coords 2 900.000000 91.484993 +node 30 coords 2 900.000000 57.568787 +node 31 coords 2 875.552429 500.000000 +node 32 coords 2 848.563599 500.000000 +node 33 coords 2 818.458130 500.000000 +node 34 coords 2 784.570496 500.000000 +node 35 coords 2 746.113525 500.000000 +node 36 coords 2 702.149414 500.000000 +node 37 coords 2 651.572083 500.000000 +node 38 coords 2 593.115417 500.000000 +node 39 coords 2 525.405273 500.000000 +node 40 coords 2 447.074524 500.000000 +node 41 coords 2 356.944366 500.000000 +node 42 coords 2 254.240860 500.000000 +node 43 coords 2 138.775726 500.000000 +node 44 coords 2 0.000000 500.000000 +node 45 coords 2 0.000000 360.076019 +node 46 coords 2 0.000000 219.966446 +node 47 coords 2 0.000000 109.983208 +node 48 coords 2 878.935547 473.539581 +node 49 coords 2 879.723022 443.877136 +node 50 coords 2 881.672485 419.235260 +node 51 coords 2 881.968079 392.962646 +node 52 coords 2 882.365784 368.033539 +node 53 coords 2 877.727966 236.751816 +node 54 coords 2 878.186951 215.276642 +node 55 coords 2 874.857788 189.177475 +node 56 coords 2 880.654297 343.041534 +node 57 coords 2 876.252563 317.506744 +node 58 coords 2 872.579651 289.776947 +node 59 coords 2 873.226990 263.396057 +node 60 coords 2 877.151672 162.014923 +node 61 coords 2 848.464172 470.395142 +node 62 coords 2 848.601562 440.401703 +node 63 coords 2 875.659790 137.510849 +node 64 coords 2 848.940186 411.388306 +node 65 coords 2 848.531494 383.558624 +node 66 coords 2 848.861389 204.232742 +node 67 coords 2 848.091736 227.235229 +node 68 coords 2 847.064941 356.830475 +node 69 coords 2 846.441711 250.595291 +node 70 coords 2 846.571838 178.505997 +node 71 coords 2 844.655884 329.850952 +node 72 coords 2 842.540283 301.936462 +node 73 coords 2 843.256592 275.166138 +node 74 coords 2 816.255310 468.365448 +node 75 coords 2 816.262451 435.483826 +node 76 coords 2 872.458435 101.911865 +node 77 coords 2 842.928711 153.343430 +node 78 coords 2 816.013123 403.608765 +node 79 coords 2 813.471558 374.514862 +node 80 coords 2 818.597961 216.517319 +node 81 coords 2 821.992676 237.732895 +node 82 coords 2 834.844788 120.387291 +node 83 coords 2 821.167969 193.690567 +node 84 coords 2 810.729187 345.419067 +node 85 coords 2 816.604797 259.828278 +node 86 coords 2 806.842957 168.979385 +node 87 coords 2 809.296021 314.220154 +node 88 coords 2 809.550354 282.029755 +node 89 coords 2 780.887268 468.643555 +node 90 coords 2 785.898254 429.370361 +node 91 coords 2 868.350830 61.739170 +node 92 coords 2 780.995239 398.208496 +node 93 coords 2 775.076355 368.068146 +node 94 coords 2 825.469543 83.332481 +node 95 coords 2 802.078735 141.094971 +node 96 coords 2 787.066162 194.222366 +node 97 coords 2 790.452942 226.194199 +node 98 coords 2 800.622681 245.997971 +node 99 coords 2 773.470825 331.750275 +node 100 coords 2 781.631470 253.296783 +node 101 coords 2 775.877136 290.544647 +node 102 coords 2 747.559753 461.154175 +node 103 coords 2 778.143799 103.791527 +node 104 coords 2 761.883972 148.253647 +node 105 coords 2 746.057556 429.100983 +node 106 coords 2 735.982788 404.722595 +node 107 coords 2 735.116577 359.037048 +node 108 coords 2 757.724792 208.741913 +node 109 coords 2 736.450439 310.305573 +node 110 coords 2 745.335266 258.583069 +node 111 coords 2 706.334167 453.328369 +node 112 coords 2 695.904480 401.934631 +node 113 coords 2 826.071960 35.569450 +node 114 coords 2 696.396362 335.902557 +node 115 coords 2 696.605164 278.509155 +node 116 coords 2 772.449646 54.619114 +node 117 coords 2 656.613525 369.914612 +node 118 coords 2 647.650024 302.002625 +node 119 coords 2 710.163330 221.670105 +node 120 coords 2 723.195557 78.650360 +node 121 coords 2 644.417419 433.159637 +node 122 coords 2 603.972534 353.860321 +node 123 coords 2 721.421997 153.109589 +node 124 coords 2 646.269104 233.199844 +node 125 coords 2 663.017700 177.478485 +node 126 coords 2 666.024109 118.539635 +node 127 coords 2 588.308105 257.428131 +node 128 coords 2 593.009644 159.887482 +node 129 coords 2 565.205383 418.769379 +node 130 coords 2 610.272583 70.090065 +node 131 coords 2 521.244751 320.242615 +node 132 coords 2 673.864868 59.946304 +node 133 coords 2 471.461456 402.520386 +node 134 coords 2 512.435486 85.804222 +node 135 coords 2 508.782654 205.401779 +node 136 coords 2 367.033264 420.028564 +node 137 coords 2 414.052185 296.122314 +node 138 coords 2 417.513306 142.334641 +node 139 coords 2 300.743744 220.636261 +node 140 coords 2 308.723083 96.996696 +node 141 coords 2 303.593323 367.699310 +node 142 coords 2 166.868607 151.789566 +node 143 coords 2 203.365555 422.039856 +node 144 coords 2 213.101395 270.257965 +node 145 coords 2 118.057777 319.183533 +node 146 coords 2 987.500000 0.000000 +node 147 coords 2 943.750000 0.000000 +node 148 coords 2 987.500000 200.000000 +node 149 coords 2 987.500000 181.928055 +node 150 coords 2 987.500000 163.477005 +node 151 coords 2 987.500000 144.086121 +node 152 coords 2 987.500000 123.124710 +node 153 coords 2 987.500000 99.854897 +node 154 coords 2 987.500000 73.386528 +node 155 coords 2 987.500000 42.629635 +node 156 coords 2 1012.500000 200.000000 +node 157 coords 2 1012.500000 181.928055 +node 158 coords 2 1012.500000 163.477005 +node 159 coords 2 1012.500000 144.086121 +node 160 coords 2 1012.500000 123.124710 +node 161 coords 2 1012.500000 99.854897 +node 162 coords 2 1012.500000 73.386528 +node 163 coords 2 1012.500000 42.629635 +node 164 coords 2 1012.500000 0.000000 +node 165 coords 2 1056.250000 0.000000 +node 166 coords 2 1100.000000 0.000000 +node 167 coords 2 1100.000000 500.000000 +node 168 coords 2 1100.000000 475.552399 +node 169 coords 2 1100.000000 451.711365 +node 170 coords 2 1100.000000 428.109802 +node 171 coords 2 1100.000000 404.331390 +node 172 coords 2 1100.000000 380.010651 +node 173 coords 2 1100.000000 354.926605 +node 174 coords 2 1100.000000 329.090668 +node 175 coords 2 1100.000000 302.784180 +node 176 coords 2 1100.000000 276.469330 +node 177 coords 2 1100.000000 250.563370 +node 178 coords 2 1100.000000 225.213165 +node 179 coords 2 1100.000000 200.219864 +node 180 coords 2 1100.000000 175.101700 +node 181 coords 2 1100.000000 149.182297 +node 182 coords 2 1100.000000 121.635910 +node 183 coords 2 1100.000000 91.484993 +node 184 coords 2 1100.000000 57.568787 +node 185 coords 2 1082.176392 500.000000 +node 186 coords 2 1064.352661 500.000000 +node 187 coords 2 1044.223633 500.000000 +node 188 coords 2 1024.911743 500.000000 +node 189 coords 2 986.941711 500.000000 +node 190 coords 2 967.353149 500.000000 +node 191 coords 2 946.701721 500.000000 +node 192 coords 2 924.447632 500.000000 +node 193 coords 2 995.226074 485.178650 +node 194 coords 2 1012.406921 487.741211 +node 195 coords 2 1010.528259 472.557617 +node 196 coords 2 977.630188 483.531677 +node 197 coords 2 1032.321899 481.204865 +node 198 coords 2 967.473938 195.405930 +node 199 coords 2 965.682495 176.083801 +node 200 coords 2 1029.443604 193.593475 +node 201 coords 2 1032.429443 175.001572 +node 202 coords 2 1077.117920 474.846375 +node 203 coords 2 961.851135 156.427612 +node 204 coords 2 1037.242310 155.810181 +node 205 coords 2 1053.166138 472.292999 +node 206 coords 2 1029.509033 463.096985 +node 207 coords 2 990.405945 468.713989 +node 208 coords 2 969.334961 465.930023 +node 209 coords 2 944.130981 190.999908 +node 210 coords 2 968.884277 215.280746 +node 211 coords 2 1026.922974 210.883835 +node 212 coords 2 1056.321045 184.929230 +node 213 coords 2 955.619019 482.172150 +node 214 coords 2 1005.271240 455.373047 +node 215 coords 2 983.742615 450.788544 +node 216 coords 2 1019.864929 441.965698 +node 217 coords 2 998.120422 436.159088 +node 218 coords 2 1042.267822 449.985809 +node 219 coords 2 1012.718750 421.387146 +node 220 coords 2 976.156677 431.791229 +node 221 coords 2 1035.290771 427.096069 +node 222 coords 2 1028.911133 407.151947 +node 223 coords 2 991.030579 416.314667 +node 224 coords 2 967.165710 412.047974 +node 225 coords 2 960.914062 447.520905 +node 226 coords 2 1007.131104 400.679077 +node 227 coords 2 983.296021 395.717682 +node 228 coords 2 956.396057 391.342438 +node 229 coords 2 950.896240 428.305267 +node 230 coords 2 936.503967 444.873169 +node 231 coords 2 944.597900 463.845764 +node 232 coords 2 956.394958 136.927322 +node 233 coords 2 1043.991455 137.356750 +node 234 coords 2 941.205505 170.521545 +node 235 coords 2 1058.952515 168.587601 +node 236 coords 2 920.450745 186.046021 +node 237 coords 2 946.429810 211.046539 +node 238 coords 2 952.278015 231.026642 +node 239 coords 2 988.418396 222.476959 +node 240 coords 2 1007.424438 216.510345 +node 241 coords 2 1051.418701 204.558533 +node 242 coords 2 1079.250244 195.155945 +node 243 coords 2 1087.505615 174.344360 +node 244 coords 2 1057.653564 430.395721 +node 245 coords 2 1054.713623 412.680389 +node 246 coords 2 1026.432739 384.030426 +node 247 coords 2 1000.768250 378.818512 +node 248 coords 2 973.731995 373.924377 +node 249 coords 2 938.749756 408.230347 +node 250 coords 2 921.776184 425.422058 +node 251 coords 2 912.710693 440.147705 +node 252 coords 2 917.521118 462.732758 +node 253 coords 2 926.983887 479.979340 +node 254 coords 2 975.684875 236.716583 +node 255 coords 2 999.082764 239.828796 +node 256 coords 2 1024.018433 232.261124 +node 257 coords 2 1049.034302 226.144836 +node 258 coords 2 1060.418701 451.444458 +node 259 coords 2 1083.553345 416.437531 +node 260 coords 2 1047.703857 392.467865 +node 261 coords 2 982.441406 256.932556 +node 262 coords 2 929.063965 148.961975 +node 263 coords 2 1073.307129 151.210266 +node 264 coords 2 915.119995 163.165970 +node 265 coords 2 919.455444 209.200424 +node 266 coords 2 924.790894 226.286865 +node 267 coords 2 937.377686 248.389160 +node 268 coords 2 1078.673096 213.751343 +node 269 coords 2 1021.221741 361.641235 +node 270 coords 2 990.817810 355.482697 +node 271 coords 2 945.290527 370.072388 +node 272 coords 2 924.036133 387.010193 +node 273 coords 2 909.757202 405.091034 +node 274 coords 2 959.214844 252.611908 +node 275 coords 2 1072.016602 238.814331 +node 276 coords 2 1081.398438 433.300751 +node 277 coords 2 1074.966797 395.830231 +node 278 coords 2 1053.369385 369.695251 +node 279 coords 2 963.811096 277.387909 +node 280 coords 2 1001.172424 265.209076 +node 281 coords 2 1045.218994 249.671188 +node 282 coords 2 913.870850 240.086990 +node 283 coords 2 943.994446 275.708740 +node 284 coords 2 1005.726135 334.523438 +node 285 coords 2 961.448975 351.153381 +node 286 coords 2 1080.038940 451.394623 +node 287 coords 2 954.224243 302.027008 +node 288 coords 2 983.218445 286.663422 +node 289 coords 2 1011.245728 289.483398 +node 290 coords 2 1018.799927 249.004593 +node 291 coords 2 1070.409058 264.684265 +node 292 coords 2 1024.867065 267.400421 +node 293 coords 2 956.039001 116.355095 +node 294 coords 2 1044.157227 116.563545 +node 295 coords 2 927.773071 348.063721 +node 296 coords 2 1084.945190 377.873749 +node 297 coords 2 920.698547 265.501770 +node 298 coords 2 1040.048584 343.120422 +node 299 coords 2 979.223328 332.450012 +node 300 coords 2 926.174683 293.845520 +node 301 coords 2 988.511475 308.533844 +node 302 coords 2 1044.543701 276.318115 +node 303 coords 2 924.614075 129.073639 +node 304 coords 2 1075.804810 129.484131 +node 305 coords 2 948.893188 327.307159 +node 306 coords 2 920.701599 325.041077 +node 307 coords 2 913.871460 367.860107 +node 308 coords 2 1071.787964 347.240601 +node 309 coords 2 1019.910950 314.808044 +node 310 coords 2 1070.689209 292.329987 +node 311 coords 2 967.301086 314.902802 +node 312 coords 2 1040.229858 297.748260 +node 313 coords 2 1054.807251 320.261871 +node 314 coords 2 939.247253 95.716988 +node 315 coords 2 1060.854980 95.819145 +node 316 coords 2 1078.490112 318.511322 +node 317 coords 2 1085.096436 106.766518 +node 318 coords 2 915.026184 106.645897 +node 319 coords 2 937.530762 60.522198 +node 320 coords 2 1062.486206 60.539227 +node 321 coords 2 1149.244141 0.000000 +node 322 coords 2 1203.338257 0.000000 +node 323 coords 2 1263.944946 0.000000 +node 324 coords 2 1332.606079 0.000000 +node 325 coords 2 1410.680420 0.000000 +node 326 coords 2 1499.274292 0.000000 +node 327 coords 2 1599.160034 0.000000 +node 328 coords 2 1710.689941 0.000000 +node 329 coords 2 1833.738403 0.000000 +node 330 coords 2 2000.000000 0.000000 +node 331 coords 2 2000.000000 500.000000 +node 332 coords 2 2000.000000 360.076019 +node 333 coords 2 2000.000000 219.966446 +node 334 coords 2 2000.000000 109.983208 +node 335 coords 2 1124.447632 500.000000 +node 336 coords 2 1151.436401 500.000000 +node 337 coords 2 1181.541870 500.000000 +node 338 coords 2 1215.429443 500.000000 +node 339 coords 2 1253.886475 500.000000 +node 340 coords 2 1297.850586 500.000000 +node 341 coords 2 1348.427856 500.000000 +node 342 coords 2 1406.884521 500.000000 +node 343 coords 2 1474.594727 500.000000 +node 344 coords 2 1552.925537 500.000000 +node 345 coords 2 1643.055542 500.000000 +node 346 coords 2 1745.759155 500.000000 +node 347 coords 2 1861.224243 500.000000 +node 348 coords 2 1124.791504 473.150757 +node 349 coords 2 1120.852905 443.723083 +node 350 coords 2 1117.790527 418.775146 +node 351 coords 2 1118.929565 394.277679 +node 352 coords 2 1123.238770 369.661591 +node 353 coords 2 1127.120728 238.010040 +node 354 coords 2 1121.929932 211.645859 +node 355 coords 2 1119.058105 189.061020 +node 356 coords 2 1127.550659 342.637787 +node 357 coords 2 1128.829102 316.139465 +node 358 coords 2 1129.120483 289.808868 +node 359 coords 2 1128.689087 263.819611 +node 360 coords 2 1119.519409 163.294540 +node 361 coords 2 1152.309204 470.280548 +node 362 coords 2 1151.649048 440.322754 +node 363 coords 2 1123.103271 137.603134 +node 364 coords 2 1151.580566 411.662231 +node 365 coords 2 1153.503540 384.205597 +node 366 coords 2 1155.291992 225.967484 +node 367 coords 2 1151.760986 202.510925 +node 368 coords 2 1156.593140 357.193085 +node 369 coords 2 1157.437500 251.228516 +node 370 coords 2 1152.105591 178.212372 +node 371 coords 2 1158.940063 330.115356 +node 372 coords 2 1159.750488 303.296387 +node 373 coords 2 1159.200684 276.942566 +node 374 coords 2 1183.960938 468.381989 +node 375 coords 2 1184.056152 435.717224 +node 376 coords 2 1126.445068 101.583275 +node 377 coords 2 1154.675171 152.973236 +node 378 coords 2 1184.799438 404.114380 +node 379 coords 2 1188.068848 375.120972 +node 380 coords 2 1185.451782 237.918823 +node 381 coords 2 1187.036499 210.783676 +node 382 coords 2 1161.469727 118.961800 +node 383 coords 2 1184.633301 190.287369 +node 384 coords 2 1191.240723 346.546783 +node 385 coords 2 1188.960693 262.856628 +node 386 coords 2 1192.842041 167.363571 +node 387 coords 2 1192.626709 317.668457 +node 388 coords 2 1191.657837 289.526489 +node 389 coords 2 1219.159912 469.057465 +node 390 coords 2 1214.212524 430.472229 +node 391 coords 2 1130.914307 61.451527 +node 392 coords 2 1219.229736 399.527435 +node 393 coords 2 1225.549316 369.566223 +node 394 coords 2 1170.801392 81.614143 +node 395 coords 2 1191.372925 137.235779 +node 396 coords 2 1217.119873 244.449188 +node 397 coords 2 1213.812256 217.421432 +node 398 coords 2 1224.574829 184.326660 +node 399 coords 2 1227.982544 335.316132 +node 400 coords 2 1221.478882 272.338654 +node 401 coords 2 1227.010864 301.457672 +node 402 coords 2 1251.377563 463.743286 +node 403 coords 2 1213.358765 98.868065 +node 404 coords 2 1234.578857 139.198700 +node 405 coords 2 1252.513672 432.520782 +node 406 coords 2 1262.325439 407.286957 +node 407 coords 2 1264.948730 361.026703 +node 408 coords 2 1250.158569 246.689728 +node 409 coords 2 1248.804565 209.647751 +node 410 coords 2 1265.209961 316.400787 +node 411 coords 2 1260.795166 274.527466 +node 412 coords 2 1289.951538 460.572174 +node 413 coords 2 1298.881836 400.942444 +node 414 coords 2 1286.037109 227.026077 +node 415 coords 2 1274.624390 161.491501 +node 416 coords 2 1172.101807 34.679230 +node 417 coords 2 1306.548218 339.847809 +node 418 coords 2 1299.368652 284.286194 +node 419 coords 2 1221.695068 51.239086 +node 420 coords 2 1350.985352 373.583923 +node 421 coords 2 1355.821899 307.292786 +node 422 coords 2 1273.187866 75.416862 +node 423 coords 2 1332.421387 443.353424 +node 424 coords 2 1337.813477 190.508255 +node 425 coords 2 1391.044678 434.869781 +node 426 coords 2 1413.319824 347.390778 +node 427 coords 2 1337.720581 250.484726 +node 428 coords 2 1405.597900 251.706940 +node 429 coords 2 1332.132080 97.178467 +node 430 coords 2 1476.265869 415.445618 +node 431 coords 2 1409.577393 150.866302 +node 432 coords 2 1486.907959 313.453979 +node 433 coords 2 1405.307251 54.092819 +node 434 coords 2 1480.769287 200.065903 +node 435 coords 2 1500.357056 75.825050 +node 436 coords 2 1577.891235 379.612183 +node 437 coords 2 1564.580566 111.634193 +node 438 coords 2 1574.510254 247.320145 +node 439 coords 2 1686.707886 280.033295 +node 440 coords 2 1705.557983 387.724518 +node 441 coords 2 1832.817993 323.428925 +node 442 coords 2 1648.067993 107.169945 +node 443 coords 2 1843.716675 140.241135 +node 444 coords 2 1750.158691 168.393570 +#** +# +#Element 799 +# +#TrPlaneStress2d Elements +# +TrPlaneStress2d 1 nodes 3 14 48 15 +TrPlaneStress2d 2 nodes 3 15 49 16 +TrPlaneStress2d 3 nodes 3 16 50 17 +TrPlaneStress2d 4 nodes 3 13 31 14 +TrPlaneStress2d 5 nodes 3 17 51 18 +TrPlaneStress2d 6 nodes 3 18 52 19 +TrPlaneStress2d 7 nodes 3 23 53 24 +TrPlaneStress2d 8 nodes 3 24 54 25 +TrPlaneStress2d 9 nodes 3 25 55 26 +TrPlaneStress2d 10 nodes 3 19 56 20 +TrPlaneStress2d 11 nodes 3 20 57 21 +TrPlaneStress2d 12 nodes 3 21 58 22 +TrPlaneStress2d 13 nodes 3 22 59 23 +TrPlaneStress2d 14 nodes 3 26 60 27 +TrPlaneStress2d 15 nodes 3 48 49 15 +TrPlaneStress2d 16 nodes 3 48 61 49 +TrPlaneStress2d 17 nodes 3 14 31 48 +TrPlaneStress2d 18 nodes 3 49 50 16 +TrPlaneStress2d 19 nodes 3 49 62 50 +TrPlaneStress2d 20 nodes 3 27 63 28 +TrPlaneStress2d 21 nodes 3 32 48 31 +TrPlaneStress2d 22 nodes 3 50 51 17 +TrPlaneStress2d 23 nodes 3 50 64 51 +TrPlaneStress2d 24 nodes 3 51 52 18 +TrPlaneStress2d 25 nodes 3 51 65 52 +TrPlaneStress2d 26 nodes 3 54 55 25 +TrPlaneStress2d 27 nodes 3 54 66 55 +TrPlaneStress2d 28 nodes 3 24 53 54 +TrPlaneStress2d 29 nodes 3 53 67 54 +TrPlaneStress2d 30 nodes 3 52 56 19 +TrPlaneStress2d 31 nodes 3 52 68 56 +TrPlaneStress2d 32 nodes 3 23 59 53 +TrPlaneStress2d 33 nodes 3 59 69 53 +TrPlaneStress2d 34 nodes 3 55 60 26 +TrPlaneStress2d 35 nodes 3 55 70 60 +TrPlaneStress2d 36 nodes 3 56 57 20 +TrPlaneStress2d 37 nodes 3 56 71 57 +TrPlaneStress2d 38 nodes 3 57 58 21 +TrPlaneStress2d 39 nodes 3 57 72 58 +TrPlaneStress2d 40 nodes 3 58 59 22 +TrPlaneStress2d 41 nodes 3 58 73 59 +TrPlaneStress2d 42 nodes 3 61 62 49 +TrPlaneStress2d 43 nodes 3 61 74 62 +TrPlaneStress2d 44 nodes 3 48 32 61 +TrPlaneStress2d 45 nodes 3 62 64 50 +TrPlaneStress2d 46 nodes 3 62 75 64 +TrPlaneStress2d 47 nodes 3 28 76 29 +TrPlaneStress2d 48 nodes 3 33 61 32 +TrPlaneStress2d 49 nodes 3 60 63 27 +TrPlaneStress2d 50 nodes 3 60 77 63 +TrPlaneStress2d 51 nodes 3 64 65 51 +TrPlaneStress2d 52 nodes 3 64 78 65 +TrPlaneStress2d 53 nodes 3 65 68 52 +TrPlaneStress2d 54 nodes 3 65 79 68 +TrPlaneStress2d 55 nodes 3 67 66 54 +TrPlaneStress2d 56 nodes 3 67 80 66 +TrPlaneStress2d 57 nodes 3 53 69 67 +TrPlaneStress2d 58 nodes 3 69 81 67 +TrPlaneStress2d 59 nodes 3 63 76 28 +TrPlaneStress2d 60 nodes 3 63 82 76 +TrPlaneStress2d 61 nodes 3 66 70 55 +TrPlaneStress2d 62 nodes 3 66 83 70 +TrPlaneStress2d 63 nodes 3 68 71 56 +TrPlaneStress2d 64 nodes 3 68 84 71 +TrPlaneStress2d 65 nodes 3 59 73 69 +TrPlaneStress2d 66 nodes 3 73 85 69 +TrPlaneStress2d 67 nodes 3 70 77 60 +TrPlaneStress2d 68 nodes 3 70 86 77 +TrPlaneStress2d 69 nodes 3 71 72 57 +TrPlaneStress2d 70 nodes 3 71 87 72 +TrPlaneStress2d 71 nodes 3 72 73 58 +TrPlaneStress2d 72 nodes 3 72 88 73 +TrPlaneStress2d 73 nodes 3 74 75 62 +TrPlaneStress2d 74 nodes 3 74 89 75 +TrPlaneStress2d 75 nodes 3 61 33 74 +TrPlaneStress2d 76 nodes 3 75 78 64 +TrPlaneStress2d 77 nodes 3 75 90 78 +TrPlaneStress2d 78 nodes 3 29 91 30 +TrPlaneStress2d 79 nodes 3 34 74 33 +TrPlaneStress2d 80 nodes 3 78 79 65 +TrPlaneStress2d 81 nodes 3 78 92 79 +TrPlaneStress2d 82 nodes 3 79 84 68 +TrPlaneStress2d 83 nodes 3 79 93 84 +TrPlaneStress2d 84 nodes 3 76 91 29 +TrPlaneStress2d 85 nodes 3 76 94 91 +TrPlaneStress2d 86 nodes 3 77 82 63 +TrPlaneStress2d 87 nodes 3 77 95 82 +TrPlaneStress2d 88 nodes 3 80 83 66 +TrPlaneStress2d 89 nodes 3 80 96 83 +TrPlaneStress2d 90 nodes 3 67 81 80 +TrPlaneStress2d 91 nodes 3 81 97 80 +TrPlaneStress2d 92 nodes 3 69 85 81 +TrPlaneStress2d 93 nodes 3 85 98 81 +TrPlaneStress2d 94 nodes 3 83 86 70 +TrPlaneStress2d 95 nodes 3 83 96 86 +TrPlaneStress2d 96 nodes 3 84 87 71 +TrPlaneStress2d 97 nodes 3 84 99 87 +TrPlaneStress2d 98 nodes 3 73 88 85 +TrPlaneStress2d 99 nodes 3 88 100 85 +TrPlaneStress2d 100 nodes 3 87 88 72 +TrPlaneStress2d 101 nodes 3 87 101 88 +TrPlaneStress2d 102 nodes 3 89 90 75 +TrPlaneStress2d 103 nodes 3 89 102 90 +TrPlaneStress2d 104 nodes 3 74 34 89 +TrPlaneStress2d 105 nodes 3 82 94 76 +TrPlaneStress2d 106 nodes 3 82 103 94 +TrPlaneStress2d 107 nodes 3 86 95 77 +TrPlaneStress2d 108 nodes 3 86 104 95 +TrPlaneStress2d 109 nodes 3 90 92 78 +TrPlaneStress2d 110 nodes 3 90 105 92 +TrPlaneStress2d 111 nodes 3 92 93 79 +TrPlaneStress2d 112 nodes 3 92 106 93 +TrPlaneStress2d 113 nodes 3 93 99 84 +TrPlaneStress2d 114 nodes 3 93 107 99 +TrPlaneStress2d 115 nodes 3 35 89 34 +TrPlaneStress2d 116 nodes 3 80 97 96 +TrPlaneStress2d 117 nodes 3 97 108 96 +TrPlaneStress2d 118 nodes 3 108 104 96 +TrPlaneStress2d 119 nodes 3 97 100 108 +TrPlaneStress2d 120 nodes 3 81 98 97 +TrPlaneStress2d 121 nodes 3 98 100 97 +TrPlaneStress2d 122 nodes 3 98 85 100 +TrPlaneStress2d 123 nodes 3 99 101 87 +TrPlaneStress2d 124 nodes 3 99 109 101 +TrPlaneStress2d 125 nodes 3 88 101 100 +TrPlaneStress2d 126 nodes 3 101 110 100 +TrPlaneStress2d 127 nodes 3 102 105 90 +TrPlaneStress2d 128 nodes 3 102 111 105 +TrPlaneStress2d 129 nodes 3 89 35 102 +TrPlaneStress2d 130 nodes 3 104 86 96 +TrPlaneStress2d 131 nodes 3 111 106 105 +TrPlaneStress2d 132 nodes 3 106 92 105 +TrPlaneStress2d 133 nodes 3 102 35 111 +TrPlaneStress2d 134 nodes 3 91 3 30 +TrPlaneStress2d 135 nodes 3 95 103 82 +TrPlaneStress2d 136 nodes 3 95 104 103 +TrPlaneStress2d 137 nodes 3 106 107 93 +TrPlaneStress2d 138 nodes 3 106 112 107 +TrPlaneStress2d 139 nodes 3 94 113 91 +TrPlaneStress2d 140 nodes 3 107 109 99 +TrPlaneStress2d 141 nodes 3 107 114 109 +TrPlaneStress2d 142 nodes 3 109 110 101 +TrPlaneStress2d 143 nodes 3 109 115 110 +TrPlaneStress2d 144 nodes 3 110 108 100 +TrPlaneStress2d 145 nodes 3 36 111 35 +TrPlaneStress2d 146 nodes 3 103 116 94 +TrPlaneStress2d 147 nodes 3 112 114 107 +TrPlaneStress2d 148 nodes 3 112 117 114 +TrPlaneStress2d 149 nodes 3 106 111 112 +TrPlaneStress2d 150 nodes 3 113 3 91 +TrPlaneStress2d 151 nodes 3 94 116 113 +TrPlaneStress2d 152 nodes 3 116 4 113 +TrPlaneStress2d 153 nodes 3 2 30 3 +TrPlaneStress2d 154 nodes 3 114 115 109 +TrPlaneStress2d 155 nodes 3 114 118 115 +TrPlaneStress2d 156 nodes 3 115 119 110 +TrPlaneStress2d 157 nodes 3 103 120 116 +TrPlaneStress2d 158 nodes 3 37 111 36 +TrPlaneStress2d 159 nodes 3 104 120 103 +TrPlaneStress2d 160 nodes 3 111 121 112 +TrPlaneStress2d 161 nodes 3 3 113 4 +TrPlaneStress2d 162 nodes 3 117 118 114 +TrPlaneStress2d 163 nodes 3 117 122 118 +TrPlaneStress2d 164 nodes 3 112 121 117 +TrPlaneStress2d 165 nodes 3 121 122 117 +TrPlaneStress2d 166 nodes 3 119 108 110 +TrPlaneStress2d 167 nodes 3 119 123 108 +TrPlaneStress2d 168 nodes 3 108 123 104 +TrPlaneStress2d 169 nodes 3 118 124 115 +TrPlaneStress2d 170 nodes 3 115 124 119 +TrPlaneStress2d 171 nodes 3 124 125 119 +TrPlaneStress2d 172 nodes 3 120 5 116 +TrPlaneStress2d 173 nodes 3 111 37 121 +TrPlaneStress2d 174 nodes 3 119 125 123 +TrPlaneStress2d 175 nodes 3 125 126 123 +TrPlaneStress2d 176 nodes 3 4 116 5 +TrPlaneStress2d 177 nodes 3 38 121 37 +TrPlaneStress2d 178 nodes 3 122 127 118 +TrPlaneStress2d 179 nodes 3 126 120 123 +TrPlaneStress2d 180 nodes 3 125 128 126 +TrPlaneStress2d 181 nodes 3 104 123 120 +TrPlaneStress2d 182 nodes 3 118 127 124 +TrPlaneStress2d 183 nodes 3 127 128 124 +TrPlaneStress2d 184 nodes 3 124 128 125 +TrPlaneStress2d 185 nodes 3 5 120 6 +TrPlaneStress2d 186 nodes 3 39 129 38 +TrPlaneStress2d 187 nodes 3 128 130 126 +TrPlaneStress2d 188 nodes 3 122 131 127 +TrPlaneStress2d 189 nodes 3 6 130 7 +TrPlaneStress2d 190 nodes 3 130 132 126 +TrPlaneStress2d 191 nodes 3 40 133 39 +TrPlaneStress2d 192 nodes 3 126 132 120 +TrPlaneStress2d 193 nodes 3 132 6 120 +TrPlaneStress2d 194 nodes 3 132 130 6 +TrPlaneStress2d 195 nodes 3 129 121 38 +TrPlaneStress2d 196 nodes 3 39 133 129 +TrPlaneStress2d 197 nodes 3 133 131 129 +TrPlaneStress2d 198 nodes 3 128 134 130 +TrPlaneStress2d 199 nodes 3 131 135 127 +TrPlaneStress2d 200 nodes 3 122 129 131 +TrPlaneStress2d 201 nodes 3 128 135 134 +TrPlaneStress2d 202 nodes 3 135 128 127 +TrPlaneStress2d 203 nodes 3 122 121 129 +TrPlaneStress2d 204 nodes 3 7 134 8 +TrPlaneStress2d 205 nodes 3 41 136 40 +TrPlaneStress2d 206 nodes 3 130 134 7 +TrPlaneStress2d 207 nodes 3 131 137 135 +TrPlaneStress2d 208 nodes 3 40 136 133 +TrPlaneStress2d 209 nodes 3 136 137 133 +TrPlaneStress2d 210 nodes 3 137 138 135 +TrPlaneStress2d 211 nodes 3 131 133 137 +TrPlaneStress2d 212 nodes 3 138 134 135 +TrPlaneStress2d 213 nodes 3 138 9 134 +TrPlaneStress2d 214 nodes 3 8 134 9 +TrPlaneStress2d 215 nodes 3 42 136 41 +TrPlaneStress2d 216 nodes 3 137 139 138 +TrPlaneStress2d 217 nodes 3 139 140 138 +TrPlaneStress2d 218 nodes 3 137 141 139 +TrPlaneStress2d 219 nodes 3 9 140 10 +TrPlaneStress2d 220 nodes 3 9 138 140 +TrPlaneStress2d 221 nodes 3 140 142 10 +TrPlaneStress2d 222 nodes 3 47 142 46 +TrPlaneStress2d 223 nodes 3 12 11 47 +TrPlaneStress2d 224 nodes 3 137 136 141 +TrPlaneStress2d 225 nodes 3 136 42 141 +TrPlaneStress2d 226 nodes 3 43 143 42 +TrPlaneStress2d 227 nodes 3 139 142 140 +TrPlaneStress2d 228 nodes 3 141 144 139 +TrPlaneStress2d 229 nodes 3 10 142 11 +TrPlaneStress2d 230 nodes 3 144 142 139 +TrPlaneStress2d 231 nodes 3 141 143 144 +TrPlaneStress2d 232 nodes 3 143 145 144 +TrPlaneStress2d 233 nodes 3 143 141 42 +TrPlaneStress2d 234 nodes 3 142 47 11 +TrPlaneStress2d 235 nodes 3 44 45 43 +TrPlaneStress2d 236 nodes 3 46 145 45 +TrPlaneStress2d 237 nodes 3 46 142 145 +TrPlaneStress2d 238 nodes 3 145 43 45 +TrPlaneStress2d 239 nodes 3 43 145 143 +TrPlaneStress2d 240 nodes 3 145 142 144 +TrPlaneStress2d 241 nodes 3 189 193 1 +TrPlaneStress2d 242 nodes 3 193 194 1 +TrPlaneStress2d 243 nodes 3 194 188 1 +TrPlaneStress2d 244 nodes 3 193 195 194 +TrPlaneStress2d 245 nodes 3 189 196 193 +TrPlaneStress2d 246 nodes 3 194 197 188 +TrPlaneStress2d 247 nodes 3 148 198 149 +TrPlaneStress2d 248 nodes 3 149 199 150 +TrPlaneStress2d 249 nodes 3 157 200 156 +TrPlaneStress2d 250 nodes 3 158 201 157 +TrPlaneStress2d 251 nodes 3 185 168 167 +TrPlaneStress2d 252 nodes 3 186 202 185 +TrPlaneStress2d 253 nodes 3 150 203 151 +TrPlaneStress2d 254 nodes 3 159 204 158 +TrPlaneStress2d 255 nodes 3 188 197 187 +TrPlaneStress2d 256 nodes 3 190 196 189 +TrPlaneStress2d 257 nodes 3 187 205 186 +TrPlaneStress2d 258 nodes 3 195 197 194 +TrPlaneStress2d 259 nodes 3 195 206 197 +TrPlaneStress2d 260 nodes 3 193 207 195 +TrPlaneStress2d 261 nodes 3 196 207 193 +TrPlaneStress2d 262 nodes 3 196 208 207 +TrPlaneStress2d 263 nodes 3 198 199 149 +TrPlaneStress2d 264 nodes 3 198 209 199 +TrPlaneStress2d 265 nodes 3 148 210 198 +TrPlaneStress2d 266 nodes 3 200 211 156 +TrPlaneStress2d 267 nodes 3 157 201 200 +TrPlaneStress2d 268 nodes 3 201 212 200 +TrPlaneStress2d 269 nodes 3 190 213 196 +TrPlaneStress2d 270 nodes 3 206 205 197 +TrPlaneStress2d 271 nodes 3 195 214 206 +TrPlaneStress2d 272 nodes 3 207 214 195 +TrPlaneStress2d 273 nodes 3 208 215 207 +TrPlaneStress2d 274 nodes 3 196 213 208 +TrPlaneStress2d 275 nodes 3 214 216 206 +TrPlaneStress2d 276 nodes 3 207 215 214 +TrPlaneStress2d 277 nodes 3 215 217 214 +TrPlaneStress2d 278 nodes 3 216 218 206 +TrPlaneStress2d 279 nodes 3 214 217 216 +TrPlaneStress2d 280 nodes 3 217 219 216 +TrPlaneStress2d 281 nodes 3 215 220 217 +TrPlaneStress2d 282 nodes 3 218 205 206 +TrPlaneStress2d 283 nodes 3 216 221 218 +TrPlaneStress2d 284 nodes 3 219 221 216 +TrPlaneStress2d 285 nodes 3 219 222 221 +TrPlaneStress2d 286 nodes 3 217 223 219 +TrPlaneStress2d 287 nodes 3 220 223 217 +TrPlaneStress2d 288 nodes 3 220 224 223 +TrPlaneStress2d 289 nodes 3 215 225 220 +TrPlaneStress2d 290 nodes 3 219 226 222 +TrPlaneStress2d 291 nodes 3 223 226 219 +TrPlaneStress2d 292 nodes 3 223 227 226 +TrPlaneStress2d 293 nodes 3 224 227 223 +TrPlaneStress2d 294 nodes 3 224 228 227 +TrPlaneStress2d 295 nodes 3 220 229 224 +TrPlaneStress2d 296 nodes 3 225 229 220 +TrPlaneStress2d 297 nodes 3 225 230 229 +TrPlaneStress2d 298 nodes 3 215 208 225 +TrPlaneStress2d 299 nodes 3 208 231 225 +TrPlaneStress2d 300 nodes 3 151 232 152 +TrPlaneStress2d 301 nodes 3 160 233 159 +TrPlaneStress2d 302 nodes 3 191 213 190 +TrPlaneStress2d 303 nodes 3 199 203 150 +TrPlaneStress2d 304 nodes 3 199 234 203 +TrPlaneStress2d 305 nodes 3 158 204 201 +TrPlaneStress2d 306 nodes 3 204 235 201 +TrPlaneStress2d 307 nodes 3 209 234 199 +TrPlaneStress2d 308 nodes 3 209 236 234 +TrPlaneStress2d 309 nodes 3 198 237 209 +TrPlaneStress2d 310 nodes 3 210 237 198 +TrPlaneStress2d 311 nodes 3 210 238 237 +TrPlaneStress2d 312 nodes 3 148 239 210 +TrPlaneStress2d 313 nodes 3 211 240 156 +TrPlaneStress2d 314 nodes 3 200 241 211 +TrPlaneStress2d 315 nodes 3 212 241 200 +TrPlaneStress2d 316 nodes 3 212 242 241 +TrPlaneStress2d 317 nodes 3 201 235 212 +TrPlaneStress2d 318 nodes 3 235 243 212 +TrPlaneStress2d 319 nodes 3 221 244 218 +TrPlaneStress2d 320 nodes 3 222 245 221 +TrPlaneStress2d 321 nodes 3 226 246 222 +TrPlaneStress2d 322 nodes 3 227 247 226 +TrPlaneStress2d 323 nodes 3 228 248 227 +TrPlaneStress2d 324 nodes 3 224 249 228 +TrPlaneStress2d 325 nodes 3 229 249 224 +TrPlaneStress2d 326 nodes 3 229 250 249 +TrPlaneStress2d 327 nodes 3 230 250 229 +TrPlaneStress2d 328 nodes 3 230 251 250 +TrPlaneStress2d 329 nodes 3 225 231 230 +TrPlaneStress2d 330 nodes 3 231 252 230 +TrPlaneStress2d 331 nodes 3 208 213 231 +TrPlaneStress2d 332 nodes 3 191 253 213 +TrPlaneStress2d 333 nodes 3 210 254 238 +TrPlaneStress2d 334 nodes 3 239 254 210 +TrPlaneStress2d 335 nodes 3 239 255 254 +TrPlaneStress2d 336 nodes 3 148 240 239 +TrPlaneStress2d 337 nodes 3 240 255 239 +TrPlaneStress2d 338 nodes 3 240 148 156 +TrPlaneStress2d 339 nodes 3 211 256 240 +TrPlaneStress2d 340 nodes 3 241 257 211 +TrPlaneStress2d 341 nodes 3 244 258 218 +TrPlaneStress2d 342 nodes 3 221 245 244 +TrPlaneStress2d 343 nodes 3 245 259 244 +TrPlaneStress2d 344 nodes 3 222 260 245 +TrPlaneStress2d 345 nodes 3 230 252 251 +TrPlaneStress2d 346 nodes 3 252 15 251 +TrPlaneStress2d 347 nodes 3 231 253 252 +TrPlaneStress2d 348 nodes 3 255 261 254 +TrPlaneStress2d 349 nodes 3 256 255 240 +TrPlaneStress2d 350 nodes 3 211 257 256 +TrPlaneStress2d 351 nodes 3 258 205 218 +TrPlaneStress2d 352 nodes 3 192 253 191 +TrPlaneStress2d 353 nodes 3 192 14 253 +TrPlaneStress2d 354 nodes 3 203 232 151 +TrPlaneStress2d 355 nodes 3 203 262 232 +TrPlaneStress2d 356 nodes 3 159 233 204 +TrPlaneStress2d 357 nodes 3 233 263 204 +TrPlaneStress2d 358 nodes 3 234 262 203 +TrPlaneStress2d 359 nodes 3 234 264 262 +TrPlaneStress2d 360 nodes 3 204 263 235 +TrPlaneStress2d 361 nodes 3 263 243 235 +TrPlaneStress2d 362 nodes 3 209 265 236 +TrPlaneStress2d 363 nodes 3 237 265 209 +TrPlaneStress2d 364 nodes 3 237 266 265 +TrPlaneStress2d 365 nodes 3 238 266 237 +TrPlaneStress2d 366 nodes 3 238 267 266 +TrPlaneStress2d 367 nodes 3 242 268 241 +TrPlaneStress2d 368 nodes 3 212 243 242 +TrPlaneStress2d 369 nodes 3 243 179 242 +TrPlaneStress2d 370 nodes 3 246 260 222 +TrPlaneStress2d 371 nodes 3 226 247 246 +TrPlaneStress2d 372 nodes 3 247 269 246 +TrPlaneStress2d 373 nodes 3 227 248 247 +TrPlaneStress2d 374 nodes 3 248 270 247 +TrPlaneStress2d 375 nodes 3 228 271 248 +TrPlaneStress2d 376 nodes 3 249 272 228 +TrPlaneStress2d 377 nodes 3 250 273 249 +TrPlaneStress2d 378 nodes 3 251 16 250 +TrPlaneStress2d 379 nodes 3 253 231 213 +TrPlaneStress2d 380 nodes 3 254 274 238 +TrPlaneStress2d 381 nodes 3 241 268 257 +TrPlaneStress2d 382 nodes 3 268 275 257 +TrPlaneStress2d 383 nodes 3 244 276 258 +TrPlaneStress2d 384 nodes 3 259 276 244 +TrPlaneStress2d 385 nodes 3 259 170 276 +TrPlaneStress2d 386 nodes 3 245 277 259 +TrPlaneStress2d 387 nodes 3 260 277 245 +TrPlaneStress2d 388 nodes 3 260 278 277 +TrPlaneStress2d 389 nodes 3 261 274 254 +TrPlaneStress2d 390 nodes 3 261 279 274 +TrPlaneStress2d 391 nodes 3 255 280 261 +TrPlaneStress2d 392 nodes 3 257 281 256 +TrPlaneStress2d 393 nodes 3 267 282 266 +TrPlaneStress2d 394 nodes 3 238 274 267 +TrPlaneStress2d 395 nodes 3 274 283 267 +TrPlaneStress2d 396 nodes 3 269 278 246 +TrPlaneStress2d 397 nodes 3 247 270 269 +TrPlaneStress2d 398 nodes 3 270 284 269 +TrPlaneStress2d 399 nodes 3 248 285 270 +TrPlaneStress2d 400 nodes 3 276 286 258 +TrPlaneStress2d 401 nodes 3 279 283 274 +TrPlaneStress2d 402 nodes 3 279 287 283 +TrPlaneStress2d 403 nodes 3 261 288 279 +TrPlaneStress2d 404 nodes 3 280 288 261 +TrPlaneStress2d 405 nodes 3 280 289 288 +TrPlaneStress2d 406 nodes 3 255 290 280 +TrPlaneStress2d 407 nodes 3 281 290 256 +TrPlaneStress2d 408 nodes 3 290 255 256 +TrPlaneStress2d 409 nodes 3 257 275 281 +TrPlaneStress2d 410 nodes 3 275 291 281 +TrPlaneStress2d 411 nodes 3 280 292 289 +TrPlaneStress2d 412 nodes 3 290 292 280 +TrPlaneStress2d 413 nodes 3 290 281 292 +TrPlaneStress2d 414 nodes 3 152 293 153 +TrPlaneStress2d 415 nodes 3 161 294 160 +TrPlaneStress2d 416 nodes 3 169 286 170 +TrPlaneStress2d 417 nodes 3 169 202 286 +TrPlaneStress2d 418 nodes 3 202 205 286 +TrPlaneStress2d 419 nodes 3 202 186 205 +TrPlaneStress2d 420 nodes 3 170 259 171 +TrPlaneStress2d 421 nodes 3 16 251 15 +TrPlaneStress2d 422 nodes 3 17 273 16 +TrPlaneStress2d 423 nodes 3 187 197 205 +TrPlaneStress2d 424 nodes 3 236 264 234 +TrPlaneStress2d 425 nodes 3 236 26 264 +TrPlaneStress2d 426 nodes 3 266 24 265 +TrPlaneStress2d 427 nodes 3 246 278 260 +TrPlaneStress2d 428 nodes 3 271 285 248 +TrPlaneStress2d 429 nodes 3 271 295 285 +TrPlaneStress2d 430 nodes 3 228 272 271 +TrPlaneStress2d 431 nodes 3 249 273 272 +TrPlaneStress2d 432 nodes 3 273 18 272 +TrPlaneStress2d 433 nodes 3 250 16 273 +TrPlaneStress2d 434 nodes 3 268 178 275 +TrPlaneStress2d 435 nodes 3 277 171 259 +TrPlaneStress2d 436 nodes 3 278 296 277 +TrPlaneStress2d 437 nodes 3 283 297 267 +TrPlaneStress2d 438 nodes 3 284 298 269 +TrPlaneStress2d 439 nodes 3 270 299 284 +TrPlaneStress2d 440 nodes 3 286 205 258 +TrPlaneStress2d 441 nodes 3 276 170 286 +TrPlaneStress2d 442 nodes 3 287 300 283 +TrPlaneStress2d 443 nodes 3 279 288 287 +TrPlaneStress2d 444 nodes 3 289 301 288 +TrPlaneStress2d 445 nodes 3 291 302 281 +TrPlaneStress2d 446 nodes 3 275 177 291 +TrPlaneStress2d 447 nodes 3 292 302 289 +TrPlaneStress2d 448 nodes 3 292 281 302 +TrPlaneStress2d 449 nodes 3 168 202 169 +TrPlaneStress2d 450 nodes 3 171 296 172 +TrPlaneStress2d 451 nodes 3 296 173 172 +TrPlaneStress2d 452 nodes 3 178 268 179 +TrPlaneStress2d 453 nodes 3 13 14 192 +TrPlaneStress2d 454 nodes 3 15 252 14 +TrPlaneStress2d 455 nodes 3 18 273 17 +TrPlaneStress2d 456 nodes 3 25 265 24 +TrPlaneStress2d 457 nodes 3 202 168 185 +TrPlaneStress2d 458 nodes 3 232 293 152 +TrPlaneStress2d 459 nodes 3 232 303 293 +TrPlaneStress2d 460 nodes 3 160 294 233 +TrPlaneStress2d 461 nodes 3 294 304 233 +TrPlaneStress2d 462 nodes 3 253 14 252 +TrPlaneStress2d 463 nodes 3 262 303 232 +TrPlaneStress2d 464 nodes 3 262 27 303 +TrPlaneStress2d 465 nodes 3 233 304 263 +TrPlaneStress2d 466 nodes 3 304 181 263 +TrPlaneStress2d 467 nodes 3 264 27 262 +TrPlaneStress2d 468 nodes 3 265 25 236 +TrPlaneStress2d 469 nodes 3 242 179 268 +TrPlaneStress2d 470 nodes 3 282 24 266 +TrPlaneStress2d 471 nodes 3 282 23 24 +TrPlaneStress2d 472 nodes 3 282 297 23 +TrPlaneStress2d 473 nodes 3 282 267 297 +TrPlaneStress2d 474 nodes 3 285 299 270 +TrPlaneStress2d 475 nodes 3 285 305 299 +TrPlaneStress2d 476 nodes 3 295 305 285 +TrPlaneStress2d 477 nodes 3 295 306 305 +TrPlaneStress2d 478 nodes 3 271 307 295 +TrPlaneStress2d 479 nodes 3 296 171 277 +TrPlaneStress2d 480 nodes 3 278 308 296 +TrPlaneStress2d 481 nodes 3 283 300 297 +TrPlaneStress2d 482 nodes 3 300 22 297 +TrPlaneStress2d 483 nodes 3 298 278 269 +TrPlaneStress2d 484 nodes 3 284 309 298 +TrPlaneStress2d 485 nodes 3 299 301 284 +TrPlaneStress2d 486 nodes 3 301 287 288 +TrPlaneStress2d 487 nodes 3 289 309 301 +TrPlaneStress2d 488 nodes 3 291 310 302 +TrPlaneStress2d 489 nodes 3 297 22 23 +TrPlaneStress2d 490 nodes 3 305 311 299 +TrPlaneStress2d 491 nodes 3 310 312 302 +TrPlaneStress2d 492 nodes 3 312 289 302 +TrPlaneStress2d 493 nodes 3 312 309 289 +TrPlaneStress2d 494 nodes 3 173 308 174 +TrPlaneStress2d 495 nodes 3 176 291 177 +TrPlaneStress2d 496 nodes 3 177 275 178 +TrPlaneStress2d 497 nodes 3 179 243 180 +TrPlaneStress2d 498 nodes 3 180 243 181 +TrPlaneStress2d 499 nodes 3 19 307 18 +TrPlaneStress2d 500 nodes 3 20 306 19 +TrPlaneStress2d 501 nodes 3 26 236 25 +TrPlaneStress2d 502 nodes 3 27 264 26 +TrPlaneStress2d 503 nodes 3 272 307 271 +TrPlaneStress2d 504 nodes 3 272 18 307 +TrPlaneStress2d 505 nodes 3 287 306 300 +TrPlaneStress2d 506 nodes 3 306 287 305 +TrPlaneStress2d 507 nodes 3 295 19 306 +TrPlaneStress2d 508 nodes 3 307 19 295 +TrPlaneStress2d 509 nodes 3 308 173 296 +TrPlaneStress2d 510 nodes 3 278 298 308 +TrPlaneStress2d 511 nodes 3 309 313 298 +TrPlaneStress2d 512 nodes 3 284 301 309 +TrPlaneStress2d 513 nodes 3 291 176 310 +TrPlaneStress2d 514 nodes 3 311 301 299 +TrPlaneStress2d 515 nodes 3 311 287 301 +TrPlaneStress2d 516 nodes 3 305 287 311 +TrPlaneStress2d 517 nodes 3 310 313 312 +TrPlaneStress2d 518 nodes 3 313 308 298 +TrPlaneStress2d 519 nodes 3 309 312 313 +TrPlaneStress2d 520 nodes 3 153 314 154 +TrPlaneStress2d 521 nodes 3 162 315 161 +TrPlaneStress2d 522 nodes 3 174 316 175 +TrPlaneStress2d 523 nodes 3 175 310 176 +TrPlaneStress2d 524 nodes 3 181 304 182 +TrPlaneStress2d 525 nodes 3 21 306 20 +TrPlaneStress2d 526 nodes 3 22 300 21 +TrPlaneStress2d 527 nodes 3 28 303 27 +TrPlaneStress2d 528 nodes 3 303 314 293 +TrPlaneStress2d 529 nodes 3 314 153 293 +TrPlaneStress2d 530 nodes 3 294 315 304 +TrPlaneStress2d 531 nodes 3 294 161 315 +TrPlaneStress2d 532 nodes 3 313 316 308 +TrPlaneStress2d 533 nodes 3 313 310 316 +TrPlaneStress2d 534 nodes 3 182 317 183 +TrPlaneStress2d 535 nodes 3 29 318 28 +TrPlaneStress2d 536 nodes 3 316 310 175 +TrPlaneStress2d 537 nodes 3 174 308 316 +TrPlaneStress2d 538 nodes 3 154 319 155 +TrPlaneStress2d 539 nodes 3 163 320 162 +TrPlaneStress2d 540 nodes 3 314 319 154 +TrPlaneStress2d 541 nodes 3 314 29 319 +TrPlaneStress2d 542 nodes 3 162 320 315 +TrPlaneStress2d 543 nodes 3 320 183 315 +TrPlaneStress2d 544 nodes 3 183 320 184 +TrPlaneStress2d 545 nodes 3 30 319 29 +TrPlaneStress2d 546 nodes 3 263 181 243 +TrPlaneStress2d 547 nodes 3 300 306 21 +TrPlaneStress2d 548 nodes 3 182 304 317 +TrPlaneStress2d 549 nodes 3 304 315 317 +TrPlaneStress2d 550 nodes 3 318 303 28 +TrPlaneStress2d 551 nodes 3 318 314 303 +TrPlaneStress2d 552 nodes 3 315 183 317 +TrPlaneStress2d 553 nodes 3 318 29 314 +TrPlaneStress2d 554 nodes 3 319 147 155 +TrPlaneStress2d 555 nodes 3 163 165 320 +TrPlaneStress2d 556 nodes 3 155 147 146 +TrPlaneStress2d 557 nodes 3 164 165 163 +TrPlaneStress2d 558 nodes 3 147 30 2 +TrPlaneStress2d 559 nodes 3 166 184 165 +TrPlaneStress2d 560 nodes 3 320 165 184 +TrPlaneStress2d 561 nodes 3 30 147 319 +TrPlaneStress2d 562 nodes 3 169 348 168 +TrPlaneStress2d 563 nodes 3 170 349 169 +TrPlaneStress2d 564 nodes 3 171 350 170 +TrPlaneStress2d 565 nodes 3 167 168 335 +TrPlaneStress2d 566 nodes 3 172 351 171 +TrPlaneStress2d 567 nodes 3 173 352 172 +TrPlaneStress2d 568 nodes 3 178 353 177 +TrPlaneStress2d 569 nodes 3 179 354 178 +TrPlaneStress2d 570 nodes 3 180 355 179 +TrPlaneStress2d 571 nodes 3 174 356 173 +TrPlaneStress2d 572 nodes 3 175 357 174 +TrPlaneStress2d 573 nodes 3 176 358 175 +TrPlaneStress2d 574 nodes 3 177 359 176 +TrPlaneStress2d 575 nodes 3 181 360 180 +TrPlaneStress2d 576 nodes 3 348 335 168 +TrPlaneStress2d 577 nodes 3 169 349 348 +TrPlaneStress2d 578 nodes 3 349 361 348 +TrPlaneStress2d 579 nodes 3 170 350 349 +TrPlaneStress2d 580 nodes 3 350 362 349 +TrPlaneStress2d 581 nodes 3 335 348 336 +TrPlaneStress2d 582 nodes 3 182 363 181 +TrPlaneStress2d 583 nodes 3 171 351 350 +TrPlaneStress2d 584 nodes 3 351 364 350 +TrPlaneStress2d 585 nodes 3 172 352 351 +TrPlaneStress2d 586 nodes 3 352 365 351 +TrPlaneStress2d 587 nodes 3 354 353 178 +TrPlaneStress2d 588 nodes 3 354 366 353 +TrPlaneStress2d 589 nodes 3 179 355 354 +TrPlaneStress2d 590 nodes 3 355 367 354 +TrPlaneStress2d 591 nodes 3 173 356 352 +TrPlaneStress2d 592 nodes 3 356 368 352 +TrPlaneStress2d 593 nodes 3 353 359 177 +TrPlaneStress2d 594 nodes 3 353 369 359 +TrPlaneStress2d 595 nodes 3 180 360 355 +TrPlaneStress2d 596 nodes 3 360 370 355 +TrPlaneStress2d 597 nodes 3 174 357 356 +TrPlaneStress2d 598 nodes 3 357 371 356 +TrPlaneStress2d 599 nodes 3 175 358 357 +TrPlaneStress2d 600 nodes 3 358 372 357 +TrPlaneStress2d 601 nodes 3 176 359 358 +TrPlaneStress2d 602 nodes 3 359 373 358 +TrPlaneStress2d 603 nodes 3 361 336 348 +TrPlaneStress2d 604 nodes 3 349 362 361 +TrPlaneStress2d 605 nodes 3 362 374 361 +TrPlaneStress2d 606 nodes 3 350 364 362 +TrPlaneStress2d 607 nodes 3 364 375 362 +TrPlaneStress2d 608 nodes 3 336 361 337 +TrPlaneStress2d 609 nodes 3 183 376 182 +TrPlaneStress2d 610 nodes 3 181 363 360 +TrPlaneStress2d 611 nodes 3 363 377 360 +TrPlaneStress2d 612 nodes 3 351 365 364 +TrPlaneStress2d 613 nodes 3 365 378 364 +TrPlaneStress2d 614 nodes 3 352 368 365 +TrPlaneStress2d 615 nodes 3 368 379 365 +TrPlaneStress2d 616 nodes 3 366 369 353 +TrPlaneStress2d 617 nodes 3 366 380 369 +TrPlaneStress2d 618 nodes 3 354 367 366 +TrPlaneStress2d 619 nodes 3 367 381 366 +TrPlaneStress2d 620 nodes 3 182 376 363 +TrPlaneStress2d 621 nodes 3 376 382 363 +TrPlaneStress2d 622 nodes 3 355 370 367 +TrPlaneStress2d 623 nodes 3 370 383 367 +TrPlaneStress2d 624 nodes 3 356 371 368 +TrPlaneStress2d 625 nodes 3 371 384 368 +TrPlaneStress2d 626 nodes 3 369 373 359 +TrPlaneStress2d 627 nodes 3 369 385 373 +TrPlaneStress2d 628 nodes 3 360 377 370 +TrPlaneStress2d 629 nodes 3 377 386 370 +TrPlaneStress2d 630 nodes 3 357 372 371 +TrPlaneStress2d 631 nodes 3 372 387 371 +TrPlaneStress2d 632 nodes 3 358 373 372 +TrPlaneStress2d 633 nodes 3 373 388 372 +TrPlaneStress2d 634 nodes 3 374 337 361 +TrPlaneStress2d 635 nodes 3 362 375 374 +TrPlaneStress2d 636 nodes 3 375 389 374 +TrPlaneStress2d 637 nodes 3 364 378 375 +TrPlaneStress2d 638 nodes 3 378 390 375 +TrPlaneStress2d 639 nodes 3 337 374 338 +TrPlaneStress2d 640 nodes 3 184 391 183 +TrPlaneStress2d 641 nodes 3 365 379 378 +TrPlaneStress2d 642 nodes 3 379 392 378 +TrPlaneStress2d 643 nodes 3 368 384 379 +TrPlaneStress2d 644 nodes 3 384 393 379 +TrPlaneStress2d 645 nodes 3 183 391 376 +TrPlaneStress2d 646 nodes 3 391 394 376 +TrPlaneStress2d 647 nodes 3 363 382 377 +TrPlaneStress2d 648 nodes 3 382 395 377 +TrPlaneStress2d 649 nodes 3 380 385 369 +TrPlaneStress2d 650 nodes 3 380 396 385 +TrPlaneStress2d 651 nodes 3 366 381 380 +TrPlaneStress2d 652 nodes 3 381 397 380 +TrPlaneStress2d 653 nodes 3 367 383 381 +TrPlaneStress2d 654 nodes 3 383 398 381 +TrPlaneStress2d 655 nodes 3 370 386 383 +TrPlaneStress2d 656 nodes 3 386 398 383 +TrPlaneStress2d 657 nodes 3 371 387 384 +TrPlaneStress2d 658 nodes 3 387 399 384 +TrPlaneStress2d 659 nodes 3 385 388 373 +TrPlaneStress2d 660 nodes 3 385 400 388 +TrPlaneStress2d 661 nodes 3 372 388 387 +TrPlaneStress2d 662 nodes 3 388 401 387 +TrPlaneStress2d 663 nodes 3 389 338 374 +TrPlaneStress2d 664 nodes 3 375 390 389 +TrPlaneStress2d 665 nodes 3 390 402 389 +TrPlaneStress2d 666 nodes 3 376 394 382 +TrPlaneStress2d 667 nodes 3 394 403 382 +TrPlaneStress2d 668 nodes 3 377 395 386 +TrPlaneStress2d 669 nodes 3 395 404 386 +TrPlaneStress2d 670 nodes 3 378 392 390 +TrPlaneStress2d 671 nodes 3 392 405 390 +TrPlaneStress2d 672 nodes 3 379 393 392 +TrPlaneStress2d 673 nodes 3 393 406 392 +TrPlaneStress2d 674 nodes 3 384 399 393 +TrPlaneStress2d 675 nodes 3 399 407 393 +TrPlaneStress2d 676 nodes 3 338 389 339 +TrPlaneStress2d 677 nodes 3 396 400 385 +TrPlaneStress2d 678 nodes 3 396 408 400 +TrPlaneStress2d 679 nodes 3 380 397 396 +TrPlaneStress2d 680 nodes 3 397 409 396 +TrPlaneStress2d 681 nodes 3 381 398 397 +TrPlaneStress2d 682 nodes 3 398 409 397 +TrPlaneStress2d 683 nodes 3 387 401 399 +TrPlaneStress2d 684 nodes 3 401 410 399 +TrPlaneStress2d 685 nodes 3 400 401 388 +TrPlaneStress2d 686 nodes 3 400 411 401 +TrPlaneStress2d 687 nodes 3 402 339 389 +TrPlaneStress2d 688 nodes 3 390 405 402 +TrPlaneStress2d 689 nodes 3 405 412 402 +TrPlaneStress2d 690 nodes 3 412 339 402 +TrPlaneStress2d 691 nodes 3 405 406 412 +TrPlaneStress2d 692 nodes 3 405 392 406 +TrPlaneStress2d 693 nodes 3 184 321 391 +TrPlaneStress2d 694 nodes 3 382 403 395 +TrPlaneStress2d 695 nodes 3 403 404 395 +TrPlaneStress2d 696 nodes 3 393 407 406 +TrPlaneStress2d 697 nodes 3 407 413 406 +TrPlaneStress2d 698 nodes 3 409 408 396 +TrPlaneStress2d 699 nodes 3 409 414 408 +TrPlaneStress2d 700 nodes 3 414 411 408 +TrPlaneStress2d 701 nodes 3 411 400 408 +TrPlaneStress2d 702 nodes 3 409 415 414 +TrPlaneStress2d 703 nodes 3 391 416 394 +TrPlaneStress2d 704 nodes 3 404 398 386 +TrPlaneStress2d 705 nodes 3 404 415 398 +TrPlaneStress2d 706 nodes 3 399 410 407 +TrPlaneStress2d 707 nodes 3 410 417 407 +TrPlaneStress2d 708 nodes 3 401 411 410 +TrPlaneStress2d 709 nodes 3 411 418 410 +TrPlaneStress2d 710 nodes 3 339 412 340 +TrPlaneStress2d 711 nodes 3 394 419 403 +TrPlaneStress2d 712 nodes 3 413 412 406 +TrPlaneStress2d 713 nodes 3 407 417 413 +TrPlaneStress2d 714 nodes 3 417 420 413 +TrPlaneStress2d 715 nodes 3 416 419 394 +TrPlaneStress2d 716 nodes 3 416 322 419 +TrPlaneStress2d 717 nodes 3 391 321 416 +TrPlaneStress2d 718 nodes 3 321 184 166 +TrPlaneStress2d 719 nodes 3 398 415 409 +TrPlaneStress2d 720 nodes 3 410 418 417 +TrPlaneStress2d 721 nodes 3 418 421 417 +TrPlaneStress2d 722 nodes 3 411 414 418 +TrPlaneStress2d 723 nodes 3 419 422 403 +TrPlaneStress2d 724 nodes 3 340 412 341 +TrPlaneStress2d 725 nodes 3 403 422 404 +TrPlaneStress2d 726 nodes 3 413 423 412 +TrPlaneStress2d 727 nodes 3 322 416 321 +TrPlaneStress2d 728 nodes 3 415 424 414 +TrPlaneStress2d 729 nodes 3 420 423 413 +TrPlaneStress2d 730 nodes 3 420 425 423 +TrPlaneStress2d 731 nodes 3 417 421 420 +TrPlaneStress2d 732 nodes 3 421 426 420 +TrPlaneStress2d 733 nodes 3 418 427 421 +TrPlaneStress2d 734 nodes 3 419 323 422 +TrPlaneStress2d 735 nodes 3 423 341 412 +TrPlaneStress2d 736 nodes 3 323 419 322 +TrPlaneStress2d 737 nodes 3 341 425 342 +TrPlaneStress2d 738 nodes 3 404 422 415 +TrPlaneStress2d 739 nodes 3 414 427 418 +TrPlaneStress2d 740 nodes 3 414 424 427 +TrPlaneStress2d 741 nodes 3 424 428 427 +TrPlaneStress2d 742 nodes 3 415 429 424 +TrPlaneStress2d 743 nodes 3 426 425 420 +TrPlaneStress2d 744 nodes 3 426 430 425 +TrPlaneStress2d 745 nodes 3 421 428 426 +TrPlaneStress2d 746 nodes 3 425 341 423 +TrPlaneStress2d 747 nodes 3 427 428 421 +TrPlaneStress2d 748 nodes 3 429 431 424 +TrPlaneStress2d 749 nodes 3 415 422 429 +TrPlaneStress2d 750 nodes 3 324 422 323 +TrPlaneStress2d 751 nodes 3 342 430 343 +TrPlaneStress2d 752 nodes 3 424 431 428 +TrPlaneStress2d 753 nodes 3 430 342 425 +TrPlaneStress2d 754 nodes 3 426 432 430 +TrPlaneStress2d 755 nodes 3 429 433 431 +TrPlaneStress2d 756 nodes 3 431 434 428 +TrPlaneStress2d 757 nodes 3 325 433 324 +TrPlaneStress2d 758 nodes 3 422 324 429 +TrPlaneStress2d 759 nodes 3 429 324 433 +TrPlaneStress2d 760 nodes 3 343 430 344 +TrPlaneStress2d 761 nodes 3 426 428 432 +TrPlaneStress2d 762 nodes 3 433 435 431 +TrPlaneStress2d 763 nodes 3 434 432 428 +TrPlaneStress2d 764 nodes 3 432 436 430 +TrPlaneStress2d 765 nodes 3 431 435 434 +TrPlaneStress2d 766 nodes 3 433 326 435 +TrPlaneStress2d 767 nodes 3 435 437 434 +TrPlaneStress2d 768 nodes 3 326 433 325 +TrPlaneStress2d 769 nodes 3 344 436 345 +TrPlaneStress2d 770 nodes 3 436 344 430 +TrPlaneStress2d 771 nodes 3 432 438 436 +TrPlaneStress2d 772 nodes 3 437 438 434 +TrPlaneStress2d 773 nodes 3 435 327 437 +TrPlaneStress2d 774 nodes 3 438 439 436 +TrPlaneStress2d 775 nodes 3 432 434 438 +TrPlaneStress2d 776 nodes 3 327 435 326 +TrPlaneStress2d 777 nodes 3 345 440 346 +TrPlaneStress2d 778 nodes 3 439 440 436 +TrPlaneStress2d 779 nodes 3 439 441 440 +TrPlaneStress2d 780 nodes 3 438 442 439 +TrPlaneStress2d 781 nodes 3 328 442 327 +TrPlaneStress2d 782 nodes 3 333 443 334 +TrPlaneStress2d 783 nodes 3 334 329 330 +TrPlaneStress2d 784 nodes 3 442 444 439 +TrPlaneStress2d 785 nodes 3 438 437 442 +TrPlaneStress2d 786 nodes 3 346 441 347 +TrPlaneStress2d 787 nodes 3 345 436 440 +TrPlaneStress2d 788 nodes 3 441 346 440 +TrPlaneStress2d 789 nodes 3 439 444 441 +TrPlaneStress2d 790 nodes 3 444 443 441 +TrPlaneStress2d 791 nodes 3 437 327 442 +TrPlaneStress2d 792 nodes 3 444 328 443 +TrPlaneStress2d 793 nodes 3 329 443 328 +TrPlaneStress2d 794 nodes 3 442 328 444 +TrPlaneStress2d 795 nodes 3 331 347 332 +TrPlaneStress2d 796 nodes 3 332 441 333 +TrPlaneStress2d 797 nodes 3 443 329 334 +TrPlaneStress2d 798 nodes 3 333 441 443 +TrPlaneStress2d 799 nodes 3 347 441 332 +#** +# +# +SimpleCS 1 thick 1.0 material 1 set 1 +SimpleCS 2 thick 1.0 material 2 set 2 +# +IsoLE 1 d 2500.000000 E 20.e3 n 0.200000 tAlpha 0.000012 +Concrete3 2 d 0. E 20.e3 n 0.2 Gf 0.1 Ft 2.5 tAlpha 0.000012 +# +BoundaryCondition 1 loadTimeFunction 1 dofs 2 1 2 values 2 0. 0. set 3 +BoundaryCondition 2 loadTimeFunction 1 dofs 1 2 values 1 0. set 4 +#BoundaryCondition 3 loadTimeFunction 2 dofs 1 2 values 1 -0.025 set 5 +NodalLoad 3 loadTimeFunction 1 dofs 2 1 2 Components 2 0. -1.0 set 5 reference +ConstantFunction 1 f(t) 2.0 +Set 1 elementranges {(1 240) (562 799)} +Set 2 elementranges {(241 561)} +Set 3 nodes 1 12 +Set 4 nodes 1 330 +Set 5 nodes 1 1 +# +# +# +#%BEGIN_CHECK% tolerance 1.e-6 +## check load levels +#LOADLEVEL tStep 1 value 6.105389 +#LOADLEVEL tStep 2 value 12.210779 +#LOADLEVEL tStep 3 value 18.160715 +#LOADLEVEL tStep 4 value 23.798851 +#LOADLEVEL tStep 5 value 28.987424 +#LOADLEVEL tStep 6 value 33.733775 +#LOADLEVEL tStep 7 value 38.101680 +#LOADLEVEL tStep 8 value 41.454458 +#LOADLEVEL tStep 9 value 43.523632 +#LOADLEVEL tStep 10 value 43.944412 +#LOADLEVEL tStep 11 value 40.616307 +#LOADLEVEL tStep 12 value 35.640997 +#LOADLEVEL tStep 13 value 33.458921 +#LOADLEVEL tStep 14 value 30.429273 +#LOADLEVEL tStep 15 value 28.534107 +#LOADLEVEL tStep 16 value 26.685269 +#LOADLEVEL tStep 17 value 25.713360 +#LOADLEVEL tStep 18 value 23.581970 +#LOADLEVEL tStep 19 value 22.329408 +#LOADLEVEL tStep 20 value 21.473918 +## check node displacement at final step +#NODE tStep 1 number 1 dof 2 unknown d value -2.50000000e-02 tolerance 1.e-9 +#NODE tStep 2 number 1 dof 2 unknown d value -5.00000000e-02 tolerance 1.e-9 +#NODE tStep 3 number 1 dof 2 unknown d value -7.50000000e-02 tolerance 1.e-9 +#NODE tStep 4 number 1 dof 2 unknown d value -1.00000000e-01 tolerance 1.e-9 +#NODE tStep 5 number 1 dof 2 unknown d value -1.25000000e-01 tolerance 1.e-9 +#NODE tStep 6 number 1 dof 2 unknown d value -1.50000000e-01 tolerance 1.e-9 +#NODE tStep 7 number 1 dof 2 unknown d value -1.75000000e-01 tolerance 1.e-9 +#NODE tStep 8 number 1 dof 2 unknown d value -2.00000000e-01 tolerance 1.e-9 +#NODE tStep 9 number 1 dof 2 unknown d value -2.23529412e-01 tolerance 1.e-9 +#NODE tStep 10 number 1 dof 2 unknown d value -2.48506881e-01 tolerance 1.e-9 +#NODE tStep 11 number 1 dof 2 unknown d value -2.73484350e-01 tolerance 1.e-9 +#NODE tStep 12 number 1 dof 2 unknown d value -2.88622210e-01 tolerance 1.e-9 +#NODE tStep 13 number 1 dof 2 unknown d value -2.99732566e-01 tolerance 1.e-9 +#NODE tStep 14 number 1 dof 2 unknown d value -3.11434890e-01 tolerance 1.e-9 +#NODE tStep 15 number 1 dof 2 unknown d value -3.23957999e-01 tolerance 1.e-9 +#NODE tStep 16 number 1 dof 2 unknown d value -3.37148350e-01 tolerance 1.e-9 +#NODE tStep 17 number 1 dof 2 unknown d value -3.51381985e-01 tolerance 1.e-9 +#NODE tStep 18 number 1 dof 2 unknown d value -3.65945211e-01 tolerance 1.e-9 +#NODE tStep 19 number 1 dof 2 unknown d value -3.80153237e-01 tolerance 1.e-9 +#NODE tStep 20 number 1 dof 2 unknown d value -3.96213669e-01 tolerance 1.e-9 +## +## +## check some arbitrary element +#ELEMENT tStep 10 number 338 gp 1 keyword 4 component 1 value 1.93951745e-03 tolerance 1.e-8 +#ELEMENT tStep 10 number 338 gp 1 keyword 4 component 2 value 1.26544635e-05 tolerance 1.e-8 +#ELEMENT tStep 10 number 338 gp 1 keyword 4 component 6 value 3.40924245e-04 tolerance 1.e-8 +#ELEMENT tStep 10 number 338 gp 1 keyword 1 component 1 value 1.01732715e+00 tolerance 1.e-8 +#ELEMENT tStep 10 number 338 gp 1 keyword 1 component 2 value 1.65217303e-01 tolerance 1.e-8 +#ELEMENT tStep 10 number 338 gp 1 keyword 1 component 6 value 7.53828658e-02 tolerance 1.e-8 +## +#ELEMENT tStep 20 number 338 gp 1 keyword 4 component 1 value 6.49791757e-03 tolerance 1.e-8 +#ELEMENT tStep 20 number 338 gp 1 keyword 4 component 2 value 6.02559845e-05 tolerance 1.e-8 +#ELEMENT tStep 20 number 338 gp 1 keyword 4 component 6 value 1.92610989e-03 tolerance 1.e-8 +#ELEMENT tStep 20 number 338 gp 1 keyword 1 component 1 value -3.38740932e-02 tolerance 1.e-8 +#ELEMENT tStep 20 number 338 gp 1 keyword 1 component 2 value -1.58065960e+00 tolerance 1.e-8 +#ELEMENT tStep 20 number 338 gp 1 keyword 1 component 6 value 2.31394491e-01 tolerance 1.e-8 +#%END_CHECK% diff --git a/tests/mpm/tm01.in b/tests/mpm/tm01.in new file mode 100644 index 000000000..59dc2fbdd --- /dev/null +++ b/tests/mpm/tm01.in @@ -0,0 +1,55 @@ +tm01.out +Test of mpm tm mpm formulation, single element, stationary (c=0.0) +# final time 500, initial time step 1 +mpmproblem nsteps 1 deltat 1.0 alpha 1.0 nmodules 1 manrmsteps 0 keeptangent ptype "tm" smtype 1 +#vtkxml tstep_all domain_all primvars 2 1 6 +errorcheck +domain HeatTransfer +outputmanager tstep_all dofman_all element_all +ndofman 8 nelem 1 nbc 5 ncrosssect 1 nic 0 nltf 2 nmat 1 nset 6 +node 1 coords 3 0. 0. 0. +node 2 coords 3 3.0 0. 0. +node 3 coords 3 3.0 2.0 0. +node 4 coords 3 0.0 2.0 0. +node 5 coords 3 0.0 0. 1.0 +node 6 coords 3 3.0 0. 1.0 +node 7 coords 3 3.0 2.0 1.0 +node 8 coords 3 0.0 2.0 1.0 +# +tmbrick11 1 nodes 8 1 2 3 4 5 6 7 8 crosssect 0 mat 1 +# +dummycs 1 mat 1 set 1 +# thermo-mechanical material model +tmm 1 d 1.0 e 5. nu 0.3 lambda 0.2 c 0.0 alpha 1.0 +# +# x-displacement +boundarycondition 1 loadtimefunction 1 set 2 values 1 0 dofs 1 1 +# y-displacement +boundarycondition 2 loadtimefunction 1 set 3 values 1 0 dofs 1 2 +# z-displacement +boundarycondition 3 loadtimefunction 1 set 4 values 1 0 dofs 1 3 +# temperature prescribed (bleeding=pressure set to zero?) +boundarycondition 4 loadtimefunction 1 set 5 values 1 2.0 dofs 1 10 +# temperature dicrete nodal flux (q=4*0.25/A = 5/6 = 0.8333333333333334) +nodalload 5 loadtimefunction 2 dofs 1 10 Components 1 0.25 set 6 +# +# +constantfunction 1 f(t) 1 +PiecewiseLinFunction 2 nPoints 4 t 4 -10. 0. 1. 5. f(t) 4 0. 0. 1.0 1.0 +set 1 elements 1 1 +# x-bc +set 2 noderanges {(1 4)} +# y-bc +set 3 noderanges {(1 4)} +# z-bc +set 4 noderanges {(1 4)} +# top surface (load + ) +set 5 noderanges {(1 4)} +# flux +set 6 nodes 4 5 6 7 8 +#%BEGIN_CHECK% +#NODE tStep 1 number 7 dof 1 unknown d value 3.31270792e+00 tolerance 1.e-5 +#NODE tStep 1 number 7 dof 2 unknown d value 3.12866859e+00 tolerance 1.e-5 +#NODE tStep 1 number 7 dof 3 unknown d value 3.34442227e+00 tolerance 1.e-5 +#NODE tStep 1 number 7 dof 10 unknown d value 2.833333334 tolerance 1.e-5 +#%END_CHECK% \ No newline at end of file diff --git a/tests/mpm/tm02.in b/tests/mpm/tm02.in new file mode 100644 index 000000000..98e7040de --- /dev/null +++ b/tests/mpm/tm02.in @@ -0,0 +1,57 @@ +tm02.out +Test of mpm tm mpm formulation, single element, transient, prescribed nodal flux +# final time 500, initial time step 1 +mpmproblem nsteps 10 deltat 1.0 alpha 1.0 nmodules 1 manrmsteps 0 keeptangent ptype "tm" smtype 1 +#vtkxml tstep_all domain_all primvars 2 1 6 +errorcheck +domain HeatTransfer +outputmanager tstep_all dofman_all element_all +ndofman 8 nelem 1 nbc 5 ncrosssect 1 nic 0 nltf 2 nmat 1 nset 7 +node 1 coords 3 0. 0. 0. +node 2 coords 3 3.0 0. 0. +node 3 coords 3 3.0 2.0 0. +node 4 coords 3 0.0 2.0 0. +node 5 coords 3 0.0 0. 1.0 +node 6 coords 3 3.0 0. 1.0 +node 7 coords 3 3.0 2.0 1.0 +node 8 coords 3 0.0 2.0 1.0 +# +tmbrick11 1 nodes 8 1 2 3 4 5 6 7 8 crosssect 0 mat 1 +# +dummycs 1 mat 1 set 1 +# thermo-mechanical material model +tmm 1 d 1.0 e 5. nu 0.3 lambda 0.2 c 0.05 alpha 1.0 +# +# x-displacement +boundarycondition 1 loadtimefunction 1 set 2 values 1 0 dofs 1 1 +# y-displacement +boundarycondition 2 loadtimefunction 1 set 3 values 1 0 dofs 1 2 +# z-displacement +boundarycondition 3 loadtimefunction 1 set 4 values 1 0 dofs 1 3 +# temperature prescribed (bleeding=pressure set to zero?) +boundarycondition 4 loadtimefunction 1 set 5 values 1 0.0 dofs 1 10 +# temperature dicrete nodal flux (q=4*0.25/A, T(1) = 5/6 = 0.8333333333333334) +nodalload 5 loadtimefunction 2 dofs 1 10 Components 1 0.25 set 6 +# +# +constantfunction 1 f(t) 1 +PiecewiseLinFunction 2 nPoints 4 t 4 -10. 0. 1. 10. f(t) 4 0. 0. 1.0 1.0 +set 1 elements 1 1 +# x-bc +set 2 nodes 2 1 4 +# y-bc +set 3 nodes 2 1 2 +# z-bc +set 4 noderanges {(1 4)} +# top surface (load + ) +set 5 noderanges {(1 4)} +# flux +set 6 nodes 4 5 6 7 8 +# all nodes +set 7 noderanges {(1 8)} +#%BEGIN_CHECK% +#NODE tStep 10 number 7 dof 3 unknown d value 4.16666667e-01 tolerance 1.e-5 +#NODE tStep 10 number 7 dof 10 unknown d value 0.833333334 tolerance 1.e-5 +#NODE tStep 10 number 8 dof 3 unknown d value 4.16666667e-01 tolerance 1.e-5 +#NODE tStep 10 number 8 dof 10 unknown d value 0.833333334 tolerance 1.e-5 +#%END_CHECK% \ No newline at end of file diff --git a/tests/mpm/tm03.in b/tests/mpm/tm03.in new file mode 100644 index 000000000..622383b58 --- /dev/null +++ b/tests/mpm/tm03.in @@ -0,0 +1,56 @@ +tm03.out +Test of mpm tm mpm formulation, single element, transient, nonzero initial condition, nodal flux +# final time 500, initial time step 1 +mpmproblem nsteps 10 deltat 1.0 alpha 1.0 nmodules 1 manrmsteps 0 keeptangent ptype "tm" smtype 1 +#vtkxml tstep_all domain_all primvars 2 1 6 +errorcheck +domain HeatTransfer +outputmanager tstep_all dofman_all element_all +ndofman 8 nelem 1 nbc 5 ncrosssect 1 nic 1 nltf 2 nmat 1 nset 7 +node 1 coords 3 0. 0. 0. ic 1 1 +node 2 coords 3 3.0 0. 0. ic 1 1 +node 3 coords 3 3.0 2.0 0. ic 1 1 +node 4 coords 3 0.0 2.0 0. ic 1 1 +node 5 coords 3 0.0 0. 1.0 ic 1 1 +node 6 coords 3 3.0 0. 1.0 ic 1 1 +node 7 coords 3 3.0 2.0 1.0 ic 1 1 +node 8 coords 3 0.0 2.0 1.0 ic 1 1 +# +tmbrick11 1 nodes 8 1 2 3 4 5 6 7 8 crosssect 0 mat 1 +# +dummycs 1 mat 1 set 1 +# thermo-mechanical material model +tmm 1 d 1.0 e 5. nu 0.3 lambda 0.2 c 0.5 alpha 1.0 +# +# x-displacement +boundarycondition 1 loadtimefunction 1 set 2 values 1 0 dofs 1 1 +# y-displacement +boundarycondition 2 loadtimefunction 1 set 3 values 1 0 dofs 1 2 +# z-displacement +boundarycondition 3 loadtimefunction 1 set 4 values 1 0 dofs 1 3 +# temperature prescribed (bleeding=pressure set to zero?) +boundarycondition 4 loadtimefunction 1 set 5 values 1 2.0 dofs 1 10 +# temperature dicrete nodal flux (q=4*0.25/A = 5/6 = 0.8333333333333334) +nodalload 5 loadtimefunction 2 dofs 1 10 Components 1 0.25 set 6 +# +initialcondition 1 set 7 conditions 1 u 2.0 dofs 1 10 +# +constantfunction 1 f(t) 1 +PiecewiseLinFunction 2 nPoints 4 t 4 -10. 0. 1. 100. f(t) 4 0. 0. 1.0 1.0 +set 1 elements 1 1 +# x-bc +set 2 nodes 4 1 4 5 8 +# y-bc +set 3 nodes 4 1 2 5 6 +# z-bc +set 4 noderanges {(1 4)} +# top surface (load + ) +set 5 noderanges {(1 4)} +# flux +set 6 nodes 4 5 6 7 8 +# initial temperature +set 7 noderanges {(1 8)} +#%BEGIN_CHECK% +#NODE tStep 10 number 7 dof 3 unknown d value 2.25876617e+00 tolerance 1.e-5 +#NODE tStep 10 number 7 dof 10 unknown d value 2.833333334 tolerance 1.e-3 +#%END_CHECK% \ No newline at end of file diff --git a/tests/mpm/tm04.in b/tests/mpm/tm04.in new file mode 100644 index 000000000..0926af2e7 --- /dev/null +++ b/tests/mpm/tm04.in @@ -0,0 +1,56 @@ +tm04.out +Test of mpm tm mpm formulation, single element, boundary flux, transient, nonzero initial condition +# final time 500, initial time step 1 +mpmproblem nsteps 10 deltat 1.0 alpha 1.0 nmodules 1 manrmsteps 0 keeptangent ptype "tm" smtype 1 +#vtkxml tstep_all domain_all primvars 2 1 6 +errorcheck +domain HeatTransfer +outputmanager tstep_all dofman_all element_all +ndofman 8 nelem 1 nbc 5 ncrosssect 1 nic 1 nltf 2 nmat 1 nset 7 +node 1 coords 3 0. 0. 0. ic 1 1 +node 2 coords 3 3.0 0. 0. ic 1 1 +node 3 coords 3 3.0 2.0 0. ic 1 1 +node 4 coords 3 0.0 2.0 0. ic 1 1 +node 5 coords 3 0.0 0. 1.0 ic 1 1 +node 6 coords 3 3.0 0. 1.0 ic 1 1 +node 7 coords 3 3.0 2.0 1.0 ic 1 1 +node 8 coords 3 0.0 2.0 1.0 ic 1 1 +# +tmbrick11 1 nodes 8 1 2 3 4 5 6 7 8 crosssect 0 mat 1 +# +dummycs 1 mat 1 set 1 +# thermo-mechanical material model +tmm 1 d 1.0 e 5. nu 0.3 lambda 0.2 c 0.5 alpha 1.0 +# +# x-displacement +boundarycondition 1 loadtimefunction 1 set 2 values 1 0 dofs 1 1 +# y-displacement +boundarycondition 2 loadtimefunction 1 set 3 values 1 0 dofs 1 2 +# z-displacement +boundarycondition 3 loadtimefunction 1 set 4 values 1 0 dofs 1 3 +# temperature prescribed (bleeding=pressure set to zero?) +boundarycondition 4 loadtimefunction 1 set 5 values 1 2.0 dofs 1 10 +# prescribed flux (q=1/6.) +constantsurfaceload 5 loadtimefunction 2 loadtype 2 dofs 1 10 cstype 0 components 1 -0.16666666 set 6 +# +initialcondition 1 set 7 conditions 1 u 2.0 dofs 1 10 +# +constantfunction 1 f(t) 1 +PiecewiseLinFunction 2 nPoints 4 t 4 -10. 0. 1. 100. f(t) 4 0. 0. 1.0 1.0 +set 1 elements 1 1 +# x-bc +set 2 nodes 4 1 4 5 8 +# y-bc +set 3 nodes 4 1 2 5 6 +# z-bc +set 4 noderanges {(1 4)} +# top surface (load + ) +set 5 noderanges {(1 4)} +# flux +set 6 elementboundaries 2 1 2 +# initial temperature +set 7 noderanges {(1 8)} +#%BEGIN_CHECK% +#NODE tStep 10 number 7 dof 3 unknown d value 2.25876617e+00 tolerance 1.e-5 +#NODE tStep 10 number 7 dof 10 unknown d value 2.833333334 tolerance 1.e-3 +#%END_CHECK% \ No newline at end of file diff --git a/tests/mpm/tm05.in b/tests/mpm/tm05.in new file mode 100644 index 000000000..29c9ce6cb --- /dev/null +++ b/tests/mpm/tm05.in @@ -0,0 +1,56 @@ +tm05.out +Test of mpm tm mpm formulation, single element, boundary flux, transient, nonzero initial condition +# final time 500, initial time step 1 +mpmproblem nsteps 10 deltat 1.0 alpha 1.0 nmodules 1 manrmsteps 0 keeptangent ptype "tm" smtype 1 +#vtkxml tstep_all domain_all primvars 2 1 6 +errorcheck +domain HeatTransfer +outputmanager tstep_all dofman_all element_all +ndofman 8 nelem 1 nbc 5 ncrosssect 1 nic 1 nltf 2 nmat 1 nset 7 +node 1 coords 3 0. 0. 0. ic 1 1 +node 2 coords 3 3.0 0. 0. ic 1 1 +node 3 coords 3 3.0 2.0 0. ic 1 1 +node 4 coords 3 0.0 2.0 0. ic 1 1 +node 5 coords 3 0.0 0. 1.0 ic 1 1 +node 6 coords 3 3.0 0. 1.0 ic 1 1 +node 7 coords 3 3.0 2.0 1.0 ic 1 1 +node 8 coords 3 0.0 2.0 1.0 ic 1 1 +# +tmbrick11 1 nodes 8 1 2 3 4 5 6 7 8 crosssect 0 mat 1 +# +dummycs 1 mat 1 set 1 +# thermo-mechanical material model +tmm 1 d 1.0 e 5. nu 0.3 lambda 0.2 c 0.5 alpha 1.0 +# +# x-displacement +boundarycondition 1 loadtimefunction 1 set 2 values 1 0 dofs 1 1 +# y-displacement +boundarycondition 2 loadtimefunction 1 set 3 values 1 0 dofs 1 2 +# z-displacement +boundarycondition 3 loadtimefunction 1 set 4 values 1 0 dofs 1 3 +# temperature prescribed (bleeding=pressure set to zero?) +boundarycondition 4 loadtimefunction 1 set 5 values 1 2.0 dofs 1 10 +# prescribed flux (q=1/6.) +constantsurfaceload 5 loadtimefunction 2 loadtype 3 dofs 1 10 cstype 0 components 1 4.0 properties 1 a 1.0 set 6 +# +initialcondition 1 set 7 conditions 1 u 2.0 dofs 1 10 +# +constantfunction 1 f(t) 1 +PiecewiseLinFunction 2 nPoints 4 t 4 -10. 0. 1. 100. f(t) 4 0. 0. 1.0 1.0 +set 1 elements 1 1 +# x-bc +set 2 nodes 4 1 2 3 4 +# y-bc +set 3 nodes 4 1 2 3 4 +# z-bc +set 4 noderanges {(1 4)} +# top surface (load + ) +set 5 noderanges {(1 4)} +# flux +set 6 elementboundaries 2 1 2 +# initial temperature +set 7 noderanges {(1 8)} +#%BEGIN_CHECK% +#NODE tStep 10 number 7 dof 3 unknown d value 3.83455311e+00 tolerance 1.e-5 +#NODE tStep 10 number 7 dof 10 unknown d value 3.66666666667 tolerance 1.e-5 +#%END_CHECK% \ No newline at end of file diff --git a/tests/mpm/tm06.in b/tests/mpm/tm06.in new file mode 100644 index 000000000..1e366352b --- /dev/null +++ b/tests/mpm/tm06.in @@ -0,0 +1,56 @@ +tm06.out +Test of mpm tm mpm formulation, single element, volumetric flux, transient, nonzero initial condition +# final time 500, initial time step 1 +mpmproblem nsteps 10 deltat 1.0 alpha 1.0 nmodules 1 manrmsteps 0 keeptangent ptype "tm" smtype 1 +#vtkxml tstep_all domain_all primvars 2 1 6 +errorcheck +domain HeatTransfer +outputmanager tstep_all dofman_all element_all +ndofman 8 nelem 1 nbc 5 ncrosssect 1 nic 1 nltf 2 nmat 1 nset 7 +node 1 coords 3 0. 0. 0. ic 1 1 +node 2 coords 3 3.0 0. 0. ic 1 1 +node 3 coords 3 3.0 2.0 0. ic 1 1 +node 4 coords 3 0.0 2.0 0. ic 1 1 +node 5 coords 3 0.0 0. 1.0 ic 1 1 +node 6 coords 3 3.0 0. 1.0 ic 1 1 +node 7 coords 3 3.0 2.0 1.0 ic 1 1 +node 8 coords 3 0.0 2.0 1.0 ic 1 1 +# +tmbrick11 1 nodes 8 1 2 3 4 5 6 7 8 crosssect 0 mat 1 +# +dummycs 1 mat 1 set 1 +# thermo-mechanical material model +tmm 1 d 1.0 e 5. nu 0.3 lambda 0.2 c 0.5 alpha 1.0 +# +# x-displacement +boundarycondition 1 loadtimefunction 1 set 2 values 1 0 dofs 1 1 +# y-displacement +boundarycondition 2 loadtimefunction 1 set 3 values 1 0 dofs 1 2 +# z-displacement +boundarycondition 3 loadtimefunction 1 set 4 values 1 0 dofs 1 3 +# temperature prescribed (bleeding=pressure set to zero?) +boundarycondition 4 loadtimefunction 1 set 5 values 1 2.0 dofs 1 10 +# prescribed flux (q=1/6.) +deadweight 5 loadTimeFunction 2 components 1 0.25 dofs 1 10 valtype 1 set 6 +# +initialcondition 1 set 7 conditions 1 u 2.0 dofs 1 10 +# +constantfunction 1 f(t) 1 +PiecewiseLinFunction 2 nPoints 4 t 4 -10. 0. 1. 100. f(t) 4 0. 0. 1.0 1.0 +set 1 elements 1 1 +# x-bc +set 2 nodes 4 1 2 3 4 +# y-bc +set 3 nodes 4 1 2 3 4 +# z-bc +set 4 noderanges {(1 4)} +# top surface (load + ) +set 5 noderanges {(1 4)} +# flux +set 6 elements 1 1 +# initial temperature +set 7 noderanges {(1 8)} +#%BEGIN_CHECK% +#NODE tStep 10 number 7 dof 3 unknown d value 3.22175 tolerance 1.e-5 +#NODE tStep 10 number 7 dof 10 unknown d value 2.625 tolerance 1.e-3 +#%END_CHECK% \ No newline at end of file diff --git a/tests/mpm/tm11.in b/tests/mpm/tm11.in new file mode 100644 index 000000000..cb8b1a48a --- /dev/null +++ b/tests/mpm/tm11.in @@ -0,0 +1,55 @@ +tm11.out +patch test of TMTetra11 elements +mpmproblem nsteps 10 deltat 1.0 alpha 1.0 nmodules 1 manrmsteps 0 keeptangent ptype "tm" smtype 1 +#vtkxml tstep_all domain_all primvars 2 1 6 +errorcheck +domain 3d +OutputManager tstep_all dofman_all element_all +ndofman 8 nelem 6 ncrosssect 1 nmat 1 nbc 4 nic 1 nltf 2 nset 6 +node 1 coords 3 0. 0. 0. +node 2 coords 3 2. 0. 0. +node 3 coords 3 2. 3. 0. +node 4 coords 3 0. 3. 0. +node 5 coords 3 0. 0. 1. +node 6 coords 3 2. 0. 1. +node 7 coords 3 2. 3. 1. +node 8 coords 3 0. 3. 1. +# +TMTetra11 1 nodes 4 1 2 4 5 +TMTetra11 2 nodes 4 5 6 2 4 +TMTetra11 3 nodes 4 5 8 6 4 +TMTetra11 4 nodes 4 3 4 2 7 +TMTetra11 5 nodes 4 7 8 4 2 +TMTetra11 6 nodes 4 8 7 6 2 +dummycs 1 mat 1 set 1 +# thermo-mechanical material model +tmm 1 d 1.0 e 5. nu 0.3 lambda 0.2 c 0.5 alpha 1.0 +BoundaryCondition 1 loadTimeFunction 1 dofs 3 1 2 3 values 3 0 0 0 set 2 +BoundaryCondition 2 loadTimeFunction 1 dofs 2 1 2 values 2 0 0 set 6 +# temperature prescribed (bleeding=pressure set to zero?) +boundarycondition 3 loadtimefunction 1 set 5 values 1 2.0 dofs 1 10 +# prescribed flux (q=1/6.) +#boundarycondition 4 loadtimefunction 2 set 6 values 1 2.0 dofs 1 10 +#nodalload 4 loadtimefunction 2 dofs 1 10 Components 1 0.1666666667 set 6 +#nodalload 4 loadtimefunction 2 dofs 1 3 Components 1 0.0 set 6 +constantsurfaceload 4 loadtimefunction 2 loadtype 3 dofs 1 10 cstype 0 components 1 4.0 properties 1 a 1.0 set 4 +# +initialcondition 1 set 5 conditions 1 u 2.0 dofs 1 10 +# +constantfunction 1 f(t) 1 +PiecewiseLinFunction 2 nPoints 4 t 4 -10. 0. 1. 100. f(t) 4 0. 0. 1.0 1.0 +Set 1 elementranges {(1 6)} +Set 2 nodes 4 1 2 3 4 +Set 3 nodes 4 1 2 3 4 +Set 4 elementboundaries 4 3 1 6 1 +Set 5 noderanges {(1 4)} +set 6 +# +#%BEGIN_CHECK% tolerance 1.e-5 +## +## Note: this is the exact solution +#NODE tStep 10 number 7 dof 3 unknown d value 4.45590439e+00 tolerance 1.e-5 +#NODE tStep 10 number 7 dof 10 unknown d value 3.66666666667 tolerance 1.e-5 +## +## +#%END_CHECK% diff --git a/tests/partests/brazil_2d_nl2/brazil_2d_errorcheck b/tests/partests/brazil_2d_nl2/brazil_2d_errorcheck deleted file mode 100644 index b1c541624..000000000 --- a/tests/partests/brazil_2d_nl2/brazil_2d_errorcheck +++ /dev/null @@ -1,6 +0,0 @@ -brazil error check -#%BEGIN_CHECK% tolerance 1.e-5 -#LOADLEVEL tStep 30 value 1.39616308e+02 -#NODE tStep 30 number 7 dof 2 unknown d value -1.30502546e-02 -#NODE tStep 30 number 3 dof 1 unknown d value 9.78700602e-04 -#%END_CHECK% diff --git a/tests/partests/brazil_2d_nl2/brazil_2d_errorcheck.in b/tests/partests/brazil_2d_nl2/brazil_2d_errorcheck.in new file mode 100644 index 000000000..693908d32 --- /dev/null +++ b/tests/partests/brazil_2d_nl2/brazil_2d_errorcheck.in @@ -0,0 +1,6 @@ +brazil_2d_nl.oofem.out +#%BEGIN_CHECK% tolerance 1.e-5 +#LOADLEVEL tStep 30 value 110.857521 +#NODE tStep 30 number 7 dof 2 unknown d value -1.08831150e-02 +#NODE tStep 30 number 3 dof 1 unknown d value 1.33260159e-03 +#%END_CHECK% diff --git a/tests/partests/brazil_2d_nl2/brazil_2d_nl2.oofem.in.0 b/tests/partests/brazil_2d_nl2/brazil_2d_nl2.oofem.in.0 index 5c32b6293..b01023cea 100644 --- a/tests/partests/brazil_2d_nl2/brazil_2d_nl2.oofem.in.0 +++ b/tests/partests/brazil_2d_nl2/brazil_2d_nl2.oofem.in.0 @@ -1,17 +1,24 @@ brazil_2d_nl2.oofem.out.0 2D brazilian splitting test -staticstructural nsteps 1 nmsteps 6 nmodules 1 -nsteps 1 stiffMode 2 solverType "calm" psi 0.0 steplength 0.0002 rtolf 1e-6 MaxIter 200 reqIterations 30 manrmsteps 10 hpcmode 1 hpc 2 3 1 initialguess 0 -nsteps 3 stiffMode 2 solverType "calm" psi 0.0 steplength 0.0001 rtolf 1e-6 MaxIter 200 reqIterations 30 manrmsteps 10 hpcmode 1 hpc 2 3 1 initialguess 0 -nsteps 3 stiffMode 2 solverType "calm" psi 0.0 steplength 0.00002 rtolf 1e-6 MaxIter 200 reqIterations 30 manrmsteps 10 hpcmode 1 hpc 2 3 1 initialguess 0 -nsteps 4 stiffMode 2 solverType "calm" psi 0.0 steplength 0.00001 rtolf 1e-6 MaxIter 200 reqIterations 30 manrmsteps 10 hpcmode 1 hpc 2 3 1 initialguess 0 -nsteps 9 stiffMode 2 solverType "calm" psi 0.0 steplength 0.0001 rtolf 1e-6 MaxIter 200 reqIterations 30 manrmsteps 10 hpcmode 1 hpc 2 3 1 initialguess 0 -nsteps 10 stiffMode 2 solverType "calm" psi 0.0 steplength 0.001 rtolf 1e-6 MaxIter 200 reqIterations 30 manrmsteps 10 hpcmode 1 hpc 2 3 1 initialguess 0 -errorcheck "brazil_2d_errorcheck" -#vtkxml tstep_all vars 3 1 2 4 primvars 1 1 stype 2 +# +nonlinearstatic nsteps 1 nmsteps 5 renumber 0 profileopt 1 nonlocalext lstype 4 smtype 7 nmodules 1 +# +#metastep 1 +nsteps 4 stiffMode 2 controlmode 0 psi 0.0 steplength 0.0001 initialsteplength 0.0002 rtolv 0.0001 MaxIter 200 reqIterations 30 manrmsteps 10 hpcmode 1 hpc 2 3 1 keepll lstype 3 +#metastep 2 +nsteps 3 stiffMode 2 controlmode 0 psi 0.0 steplength 0.00002 rtolv 0.0001 MaxIter 200 reqIterations 30 manrmsteps 10 hpcmode 1 hpc 2 3 1 keepll lstype 3 +#metastep 3 +nsteps 4 stiffMode 2 controlmode 0 psi 0.0 steplength 0.00001 rtolv 0.0001 MaxIter 200 reqIterations 30 manrmsteps 10 hpcmode 1 hpc 2 3 1 keepll lstype 3 +#metastep 4 +nsteps 9 stiffMode 2 controlmode 0 psi 0.0 steplength 0.0001 rtolv 0.0001 MaxIter 200 reqIterations 30 manrmsteps 10 hpcmode 1 hpc 2 3 1 keepll lstype 3 +#metastep 5 +nsteps 10 stiffMode 2 controlmode 0 psi 0.0 steplength 0.001 rtolv 0.0001 MaxIter 200 reqIterations 30 manrmsteps 10 hpcmode 1 hpc 2 3 1 keepll lstype 3 +# +errorcheck filename "brazil_2d_errorcheck.in" +# domain PlaneStrain OutputManager tstep_all dofman_all element_all -ndofman 287 nelem 257 ncrosssect 2 nmat 2 nbc 2 nic 0 nltf 1 nset 5 +ndofman 287 nelem 257 ncrosssect 2 nmat 2 nbc 2 nic 0 nltf 1 node 1 coords 3 0.000000e+00 0.000000e+00 0.000000e+00 bc 2 1 1 node 3 coords 3 5.000000e+00 0.000000e+00 0.000000e+00 bc 2 0 1 node 9 coords 3 1.000000e+00 0.000000e+00 0.000000e+00 bc 2 0 1 @@ -556,11 +563,6 @@ Quad1PlaneStrain 368 nodes 4 419 404 400 401 mat 1 crossSect 1 Quad1PlaneStrain 369 nodes 4 390 418 392 391 mat 1 crossSect 1 Quad1PlaneStrain 370 nodes 4 369 419 401 402 mat 1 crossSect 1 Quad1PlaneStrain 371 nodes 4 229 230 281 329 Remote partitions 1 1 mat 1 crossSect 1 -Set 1 elementranges {(1 371)} -Set 2 elementranges {(372 386)} -Set 3 noderanges {1 5 7 (42 79) 85 86} -Set 4 noderanges {(1 3) (9 22)} -Set 5 elementboundaries 2 378 1 SimpleCS 1 thick 1.0 SimpleCS 2 thick 1.0 idmnl1 1 d 1.0 E 37.7e3 n 0.2 talpha 0.0 e0 6.75e-5 ef 3.0e-4 R 5.0 equivstraintype 1 regionMap 2 0 1 @@ -568,5 +570,10 @@ IsoLE 2 d 1.0 E 300.e3 n 0.2 talpha 0.0 ##idmnl1 1 d 1.0 E 30.e3 n 0.18 talpha 0.0 e0 0.00011666666667 ef 0.0059953333333 R 5.0 equivstraintype 1 regionMap 2 0 1 ##IsoLE 2 d 1.0 E 210.e3 n 0.3 talpha 0.0 BoundaryCondition 1 loadTimeFunction 1 prescribedvalue 0.0 -ConstantEdgeLoad 3 loadTimeFunction 1 dofs 2 1 2 components 2 0 -1.0 loadType 3 set 5 reference +ConstantEdgeLoad 2 loadTimeFunction 1 components 2 0 -1.0 loadType 3 ndofs 2 ConstantFunction 1 f(t) 1.0 + +#%BEGIN_CHECK% tolerance 1.e-5 +#LOADLEVEL tStep 29 value 110.857521 +#NODE tStep 29 number 3 dof 1 unknown d value 1.33260159e-03 +#%END_CHECK% \ No newline at end of file diff --git a/tests/partests/brazil_2d_nl2/brazil_2d_nl2.oofem.in.1 b/tests/partests/brazil_2d_nl2/brazil_2d_nl2.oofem.in.1 index 93db7242e..79c17c5c3 100644 --- a/tests/partests/brazil_2d_nl2/brazil_2d_nl2.oofem.in.1 +++ b/tests/partests/brazil_2d_nl2/brazil_2d_nl2.oofem.in.1 @@ -1,17 +1,23 @@ brazil_2d_nl2.oofem.out.1 2D brazilian splitting test -staticstructural nsteps 1 nmsteps 6 nmodules 1 -nsteps 1 stiffMode 2 solverType "calm" psi 0.0 steplength 0.0002 rtolf 1e-6 MaxIter 200 reqIterations 30 manrmsteps 10 hpcmode 1 hpc 2 3 1 initialguess 0 -nsteps 3 stiffMode 2 solverType "calm" psi 0.0 steplength 0.0001 rtolf 1e-6 MaxIter 200 reqIterations 30 manrmsteps 10 hpcmode 1 hpc 2 3 1 initialguess 0 -nsteps 3 stiffMode 2 solverType "calm" psi 0.0 steplength 0.00002 rtolf 1e-6 MaxIter 200 reqIterations 30 manrmsteps 10 hpcmode 1 hpc 2 3 1 initialguess 0 -nsteps 4 stiffMode 2 solverType "calm" psi 0.0 steplength 0.00001 rtolf 1e-6 MaxIter 200 reqIterations 30 manrmsteps 10 hpcmode 1 hpc 2 3 1 initialguess 0 -nsteps 9 stiffMode 2 solverType "calm" psi 0.0 steplength 0.0001 rtolf 1e-6 MaxIter 200 reqIterations 30 manrmsteps 10 hpcmode 1 hpc 2 3 1 initialguess 0 -nsteps 10 stiffMode 2 solverType "calm" psi 0.0 steplength 0.001 rtolf 1e-6 MaxIter 200 reqIterations 30 manrmsteps 10 hpcmode 1 hpc 2 3 1 initialguess 0 -errorcheck "brazil_2d_errorcheck" -#vtkxml tstep_all vars 3 1 2 4 primvars 1 1 stype 2 +# +nonlinearstatic nsteps 1 nmsteps 5 renumber 0 profileopt 1 nonlocalext lstype 4 smtype 7 nmodules 1 +# +#metastep 1 +nsteps 4 stiffMode 2 controlmode 0 psi 0.0 steplength 0.0001 initialsteplength 0.0002 rtolv 0.0001 MaxIter 200 reqIterations 30 manrmsteps 10 hpcmode 1 hpc 2 3 1 keepll lstype 3 +#metastep 2 +nsteps 3 stiffMode 2 controlmode 0 psi 0.0 steplength 0.00002 rtolv 0.0001 MaxIter 200 reqIterations 30 manrmsteps 10 hpcmode 1 hpc 2 3 1 keepll lstype 3 +#metastep 3 +nsteps 4 stiffMode 2 controlmode 0 psi 0.0 steplength 0.00001 rtolv 0.0001 MaxIter 200 reqIterations 30 manrmsteps 10 hpcmode 1 hpc 2 3 1 keepll lstype 3 +#metastep 4 +nsteps 9 stiffMode 2 controlmode 0 psi 0.0 steplength 0.0001 rtolv 0.0001 MaxIter 200 reqIterations 30 manrmsteps 10 hpcmode 1 hpc 2 3 1 keepll lstype 3 +#metastep 5 +nsteps 10 stiffMode 2 controlmode 0 psi 0.0 steplength 0.001 rtolv 0.0001 MaxIter 200 reqIterations 30 manrmsteps 10 hpcmode 1 hpc 2 3 1 keepll lstype 3 +# +errorcheck filename "brazil_2d_errorcheck.in" domain PlaneStrain OutputManager tstep_all dofman_all element_all -ndofman 315 nelem 276 ncrosssect 2 nmat 2 nbc 2 nic 0 nltf 1 nset 5 +ndofman 315 nelem 276 ncrosssect 2 nmat 2 nbc 2 nic 0 nltf 1 node 2 coords 3 4.000000e+01 0.000000e+00 0.000000e+00 bc 2 0 1 node 4 coords 3 5.000000e+00 3.968627e+01 0.000000e+00 node 5 coords 3 0.000000e+00 3.968627e+01 0.000000e+00 bc 2 1 0 @@ -603,11 +609,6 @@ Quad1PlaneStrain 383 nodes 4 39 38 420 427 mat 2 crossSect 2 Quad1PlaneStrain 384 nodes 4 420 421 422 427 mat 2 crossSect 2 Quad1PlaneStrain 385 nodes 4 422 423 426 427 mat 2 crossSect 2 Quad1PlaneStrain 386 nodes 4 423 424 425 426 mat 2 crossSect 2 -Set 1 elementranges {(1 371)} -Set 2 elementranges {(372 386)} -Set 3 noderanges {1 5 7 (42 79) 85 86} -Set 4 noderanges {(1 3) (9 22)} -Set 5 elementboundaries 2 378 1 SimpleCS 1 thick 1.0 SimpleCS 2 thick 1.0 idmnl1 1 d 1.0 E 37.7e3 n 0.2 talpha 0.0 e0 6.75e-5 ef 3.0e-4 R 5.0 equivstraintype 1 regionMap 2 0 1 @@ -615,5 +616,10 @@ IsoLE 2 d 1.0 E 300.e3 n 0.2 talpha 0.0 ##idmnl1 1 d 1.0 E 30.e3 n 0.18 talpha 0.0 e0 0.00011666666667 ef 0.0059953333333 R 5.0 equivstraintype 1 regionMap 2 0 1 ##IsoLE 2 d 1.0 E 210.e3 n 0.3 talpha 0.0 BoundaryCondition 1 loadTimeFunction 1 prescribedvalue 0.0 -ConstantEdgeLoad 3 loadTimeFunction 1 dofs 2 1 2 components 2 0 -1.0 loadType 3 set 5 reference +ConstantEdgeLoad 2 loadTimeFunction 1 components 2 0 -1.0 loadType 3 ndofs 2 ConstantFunction 1 f(t) 1.0 + +#%BEGIN_CHECK% tolerance 1.e-5 +#LOADLEVEL tStep 29 value 110.857521 +#NODE tStep 29 number 7 dof 2 unknown d value -1.08831150e-02 +#%END_CHECK% diff --git a/tests/sm/beam2d_1_CM.in b/tests/sm/beam2d_1_CM.in new file mode 100644 index 000000000..12be00d26 --- /dev/null +++ b/tests/sm/beam2d_1_CM.in @@ -0,0 +1,62 @@ +beam2d_1_CM.out +Homework www sm40 no. 1 +#only momentum influence to the displacements is taken into account +#beamShearCoeff is artificially enlarged. +StaticStructural nsteps 3 nmodules 1 +#vtkxml tstep_all primvars 1 1 vars 1 7 stype 0 +errorcheck +domain 2dBeam +OutputManager tstep_all dofman_all element_all +ndofman 6 nelem 5 ncrosssect 1 nmat 1 nbc 6 nic 0 nltf 3 nset 7 +node 1 coords 3 0. 0. 0. +node 2 coords 3 2.4 0. 0. +node 3 coords 3 3.8 0. 0. +node 4 coords 3 5.8 1.5 0. +node 5 coords 3 7.8 3.0 0. +node 6 coords 3 2.4 3.0 0. +Beam2d 1 nodes 2 1 2 +Beam2d 2 nodes 2 2 3 DofsToCondense 1 6 +Beam2d 3 nodes 2 3 4 DofsToCondense 1 3 +Beam2d 4 nodes 2 4 5 +Beam2d 5 nodes 2 6 2 DofsToCondense 1 6 +SimpleCS 1 area 1.e8 Iy 0.0039366 beamShearCoeff 1.e18 thick 0.54 material 1 set 1 +IsoLE 1 d 1. E 30.e6 n 0.2 tAlpha 1.2e-5 +BoundaryCondition 1 loadTimeFunction 1 dofs 1 2 values 1 0.0 set 4 +BoundaryCondition 2 loadTimeFunction 1 dofs 1 5 values 1 0.0 set 5 +BoundaryCondition 3 loadTimeFunction 2 dofs 3 1 2 5 values 3 0.0 0.0 -0.006e-3 set 6 +ConstantEdgeLoad 4 loadTimeFunction 1 Components 3 0.0 10.0 0.0 loadType 3 set 3 +NodalLoad 5 loadTimeFunction 1 dofs 3 1 2 5 Components 3 -18.0 24.0 0.0 set 2 +StructTemperatureLoad 6 loadTimeFunction 3 Components 2 30.0 -20.0 set 7 +PeakFunction 1 t 1.0 f(t) 1. +PeakFunction 2 t 2.0 f(t) 1. +PeakFunction 3 t 3.0 f(t) 1. +Set 1 elementranges {(1 5)} +Set 2 nodes 1 4 +Set 3 elementedges 2 1 1 +Set 4 nodes 2 1 5 +Set 5 nodes 1 3 +Set 6 nodes 1 6 +Set 7 elements 2 1 2 +# +# exact solution +# +#%BEGIN_CHECK% tolerance 5.e-3 +## check reactions +#REACTION tStep 1 number 1 dof 2 value -8.9376e+00 tolerance 1.e-4 +#REACTION tStep 1 number 3 dof 5 value 0.0000e+00 tolerance 1.e-4 +#REACTION tStep 1 number 5 dof 2 value -1.8750e+01 tolerance 1.e-3 +#REACTION tStep 1 number 6 dof 1 value 1.8000e+01 tolerance 1.e-3 +#REACTION tStep 1 number 6 dof 2 value -2.0312e+01 tolerance 1.e-3 +#REACTION tStep 1 number 6 dof 5 value -5.4002e+01 tolerance 5.e-3 +## +## check all nodes +#NODE tStep 1 number 4 dof 1 unknown d value -1.75287942e-03 +#NODE tStep 2 number 4 dof 1 unknown d value 1.79999937e-05 +#NODE tStep 3 number 4 dof 1 unknown d value 9.47323653e-04 +## check element no. 1 force vector +##ELEMENT tStep 1 number 1 gp 1 keyword 7 component 6 value -7.3498e+00 tolerance 1.e-2 +##ELEMENT tStep 1 number 1 gp 1 keyword 7 component 5 value -1.5062e+01 tolerance 2.e-3 +#%END_CHECK% + + + diff --git a/tests/sm/hangingnode01.in b/tests/sm/hangingnode01.in index cacf1dbf6..05ea68ce2 100644 --- a/tests/sm/hangingnode01.in +++ b/tests/sm/hangingnode01.in @@ -1,9 +1,9 @@ hangingnode01.out Test of hanging node in PlaneStress2d element -LinearStatic nsteps 1 nmodules 1 -errorcheck #LinearStatic nsteps 1 nmodules 1 -#vtkxml tstep_all domain_all primvars 1 1 vars 2 1 4 stype 1 +#errorcheck +LinearStatic nsteps 1 nmodules 1 +vtkxml tstep_all domain_all primvars 1 1 vars 2 1 4 stype 1 domain 2dPlaneStress OutputManager tstep_all dofman_all element_all ndofman 5 nelem 1 ncrosssect 1 nmat 1 nbc 3 nic 0 nltf 1 nset 4 diff --git a/tests/sm/steelRelaxMat_vtk.in b/tests/sm/steelRelaxMat_vtk.in new file mode 100644 index 000000000..691ebb980 --- /dev/null +++ b/tests/sm/steelRelaxMat_vtk.in @@ -0,0 +1,74 @@ +steelRelaxMat.out +relaxation of prestressing reinforcement, all dofs fixed +# +StaticStructural nsteps 25 prescribedTimes 25 0.0001 0.0002 0.0005 0.001 0.002 0.005 0.01 0.02 0.05 0.1 0.2 0.5 1. 2. 5. 10. 20. 50. 100. 200. 500. 1000. 2000. 5000. 10000. nmodules 1 +# +#errorcheck +vtkxml tstep_step 1 domain_all vars 2 1 4 primvars 1 1 +# +domain 2dPlaneStress +# +OutputManager tstep_all dofman_all element_all +ndofman 12 nelem 4 ncrosssect 3 nmat 3 nbc 3 nic 0 nltf 2 nset 2 +# +# +# NODES +# +node 1 coords 2 0.0 0.0 +node 2 coords 2 0.1 0.0 +node 3 coords 2 0.0 0.1 +node 4 coords 2 0.1 0.1 +# +hangingNode 5 coords 2 0.0 0.05 dofType 2 2 2 masterElement 2 +hangingNode 6 coords 2 0.1 0.05 dofType 2 2 2 masterElement 2 +# +node 7 coords 2 0.0 0.2 +node 8 coords 2 0.1 0.2 +node 9 coords 2 0.0 0.3 +node 10 coords 2 0.1 0.3 +# +hangingNode 11 coords 2 0.0 0.25 dofType 2 2 2 masterElement 4 +hangingNode 12 coords 2 0.1 0.25 dofType 2 2 2 masterElement 4 +# +# +# ELEMENTS +# +Truss2d 1 nodes 2 5 6 crossSect 2 cs 1 bodyLoads 1 3 +PlaneStress2d 2 nodes 4 1 2 4 3 crossSect 1 +Truss2d 3 nodes 2 11 12 crossSect 3 cs 1 bodyLoads 1 3 +PlaneStress2d 4 nodes 4 7 8 10 9 crossSect 1 +# +Set 1 nodes 2 1 7 +Set 2 nodes 2 3 9 +# +# CROSSECTION +# +SimpleCS 1 thick 1.0 width 1.0 material 1 +SimpleCS 2 thick 1.0 area 0.001 material 2 +SimpleCS 3 thick 1.0 area 0.001 material 3 +# +# +# MATERIAL +# +IsoLE 1 d 0. n 0.2 E 30.e3 talpha 0. +SteelRelaxMat 2 d 0. E 200.e3 ReinfClass 1 timeFactor 1. charStrength 1000. approach 0 +SteelRelaxMat 3 d 0. E 200.e3 ReinfClass 1 timeFactor 1. charStrength 1000. approach 1 +# +# +BoundaryCondition 1 loadTimeFunction 1 dofs 2 1 2 values 2 0. 0. set 1 +BoundaryCondition 2 loadTimeFunction 1 dofs 1 1 values 1 0. set 2 +# +StructEigenstrainLoad 3 loadTimeFunction 2 Components 1 -4.e-3 +# +# +# TIME FUNCTION +# +ConstantFunction 1 f(t) 1.0 +HeavisideLTF 2 origin 0.0 value 1.0 +# +#%BEGIN_CHECK% tolerance 5.e-3 +#ELEMENT tStep 10 number 1 gp 1 keyword 1 component 1 value 7.35062615e+02 +#ELEMENT tStep 10 number 3 gp 1 keyword 1 component 1 value 7.34992211e+02 +#ELEMENT tStep 25 number 1 gp 1 keyword 1 component 1 value 6.19512976e+02 +#ELEMENT tStep 25 number 3 gp 1 keyword 1 component 1 value 6.18253822e+02 +#%END_CHECK% diff --git a/tests/sm/steelRelaxMat_vtk_CM.in b/tests/sm/steelRelaxMat_vtk_CM.in new file mode 100644 index 000000000..4596fe0ee --- /dev/null +++ b/tests/sm/steelRelaxMat_vtk_CM.in @@ -0,0 +1,63 @@ +steelRelaxMat_CM.out +relaxation of prestressing reinforcement, all dofs fixed +# +StaticStructural nsteps 2 prescribedTimes 2 0.0001 0.0002 nmodules 1 +# +#errorcheck +vtkxml tstep_step 1 domain_all vars 2 1 4 primvars 1 1 +# +domain 2dPlaneStress +# +OutputManager tstep_all dofman_all element_all +ndofman 6 nelem 2 ncrosssect 2 nmat 2 nbc 3 nic 0 nltf 1 nset 4 +# +# +# NODES +# +node 1 coords 2 0.0 0.0 dofidmask 3 1 2 5 +node 2 coords 2 0.1 0.0 dofidmask 3 1 2 5 +node 3 coords 2 0.0 0.1 dofidmask 3 1 2 5 +node 4 coords 2 0.1 0.1 dofidmask 3 1 2 5 +# +hangingNode 5 coords 3 0.0 0.05 0.0 dofType 3 2 2 2 masterElement 2 dofidmask 3 1 2 5 +hangingNode 6 coords 3 0.1 0.05 0.0 dofType 3 2 2 2 masterElement 2 dofidmask 3 1 2 5 +# +# +# ELEMENTS +# +#Beam3d 1 nodes 2 5 6 refNode 1 crossSect 2 DofsToCondense 6 3 4 6 9 10 12 +Beam2d 1 nodes 2 5 6 crossSect 2 +#Truss2d 1 nodes 2 5 6 crossSect 2 cs 1 +PlaneStress2d 2 nodes 4 1 2 4 3 crossSect 1 +# +Set 1 nodes 1 1 +Set 2 nodes 1 3 +Set 3 elements 1 1 +Set 4 nodes 1 2 +# +# CROSSECTION +# +SimpleCS 1 thick 1.0 width 1.0 material 1 +SimpleCS 2 area 1.e6 Iy 0.002343466 beamShearCoeff 1.e18 thick 0.54 material 2 +# +# +# MATERIAL +# +IsoLE 1 d 0. n 0.2 E 30.e3 talpha 0. +IsoLE 2 d 1. E 30.e6 n 0.2 tAlpha 0. +# +# +BoundaryCondition 1 loadTimeFunction 1 dofs 2 1 2 values 2 0. 0. set 1 +BoundaryCondition 2 loadTimeFunction 1 dofs 1 1 values 1 0. set 2 +# +NodalLoad 3 loadTimeFunction 1 dofs 2 1 2 components 2 2.5 1.0 set 4 +# +# +# TIME FUNCTION +# +ConstantFunction 1 f(t) 1.0 +# +#%BEGIN_CHECK% tolerance 5.e-3 +#ELEMENT tStep 1 number 1 gp 1 keyword 1 component 1 value 7.35062615e+02 +#ELEMENT tStep 1 number 3 gp 1 keyword 1 component 1 value 7.34992211e+02 +#%END_CHECK% diff --git a/tests/sm/steelRelaxMat_vtk_CM2.in b/tests/sm/steelRelaxMat_vtk_CM2.in new file mode 100644 index 000000000..1c7e5ba09 --- /dev/null +++ b/tests/sm/steelRelaxMat_vtk_CM2.in @@ -0,0 +1,64 @@ +steelRelaxMat_CM2.out +relaxation of prestressing reinforcement, all dofs fixed +# +StaticStructural nsteps 2 prescribedTimes 2 0.0001 0.0002 nmodules 1 +# +#errorcheck +vtkxml tstep_step 1 domain_all vars 2 1 4 primvars 1 1 +# +domain 2dPlaneStress +# +OutputManager tstep_all dofman_all element_all +ndofman 6 nelem 2 ncrosssect 2 nmat 2 nbc 3 nic 0 nltf 1 nset 3 +# +# +# NODES +# +node 1 coords 2 0.0 0.0 +node 2 coords 2 0.1 0.0 +node 3 coords 2 0.0 0.1 +node 4 coords 2 0.1 0.1 +# +hangingNode 5 coords 3 0.0 0.05 0.0 dofType 3 2 2 2 masterElementRot 2 dofidmask 3 1 2 5 +hangingNode 6 coords 3 0.1 0.05 0.0 dofType 3 2 2 2 masterElementRot 2 dofidmask 3 1 2 5 +#hangingNode 5 coords 2 0.0 0.05 dofType 2 2 2 masterElement 2 dofidmask 2 1 2 +#hangingNode 6 coords 2 0.1 0.05 dofType 2 2 2 masterElement 2 dofidmask 2 1 2 +# +# +# ELEMENTS +# +#Beam3d 1 nodes 2 5 6 refNode 1 crossSect 2 DofsToCondense 6 3 4 6 9 10 12 +Beam2d 1 nodes 2 5 6 crossSect 2 +#Truss2d 1 nodes 2 5 6 crossSect 2 cs 1 +PlaneStress2d 2 nodes 4 1 2 4 3 crossSect 1 +# +Set 1 nodes 1 1 +Set 2 nodes 1 3 +Set 3 nodes 1 2 +# +# CROSSECTION +# +SimpleCS 1 thick 1.0 width 1.0 material 1 +SimpleCS 2 area 0.000314159 Iy 0.0000002343466 beamShearCoeff 1.e18 thick 0.02 material 2 +# +# +# MATERIAL +# +IsoLE 1 d 0. n 0.2 E 30.e3 talpha 0. +IsoLE 2 d 1. E 200.e3 n 0.2 tAlpha 0. +# +# +BoundaryCondition 1 loadTimeFunction 1 dofs 2 1 2 values 2 0. 0. set 1 +BoundaryCondition 2 loadTimeFunction 1 dofs 1 1 values 1 0. set 2 +# +NodalLoad 3 loadTimeFunction 1 dofs 2 1 2 components 2 1.0 1.0 set 3 +# +# +# TIME FUNCTION +# +ConstantFunction 1 f(t) 1.0 +# +#%BEGIN_CHECK% tolerance 5.e-3 +#ELEMENT tStep 1 number 1 gp 1 keyword 1 component 1 value 7.35062615e+02 +#ELEMENT tStep 1 number 3 gp 1 keyword 1 component 1 value 7.34992211e+02 +#%END_CHECK% diff --git a/tests/sm/steelRelaxMat_vtk_CM2_Truss.in b/tests/sm/steelRelaxMat_vtk_CM2_Truss.in new file mode 100644 index 000000000..5aa151acd --- /dev/null +++ b/tests/sm/steelRelaxMat_vtk_CM2_Truss.in @@ -0,0 +1,64 @@ +steelRelaxMat_CM2_Truss.out +relaxation of prestressing reinforcement, all dofs fixed +# +StaticStructural nsteps 2 prescribedTimes 2 0.0001 0.0002 nmodules 1 +# +#errorcheck +vtkxml tstep_step 1 domain_all vars 2 1 4 primvars 1 1 +# +domain 2dPlaneStress +# +OutputManager tstep_all dofman_all element_all +ndofman 6 nelem 2 ncrosssect 2 nmat 2 nbc 3 nic 0 nltf 1 nset 3 +# +# +# NODES +# +node 1 coords 2 0.0 0.0 +node 2 coords 2 0.1 0.0 +node 3 coords 2 0.0 0.1 +node 4 coords 2 0.1 0.1 +# +#hangingNode 5 coords 3 0.0 0.05 0.0 dofType 3 2 2 2 masterElementRot 2 dofidmask 3 1 2 5 +#hangingNode 6 coords 3 0.1 0.05 0.0 dofType 3 2 2 2 masterElementRot 2 dofidmask 3 1 2 5 +hangingNode 5 coords 2 0.0 0.05 dofType 2 2 2 masterElement 2 dofidmask 2 1 2 +hangingNode 6 coords 2 0.1 0.05 dofType 2 2 2 masterElement 2 dofidmask 2 1 2 +# +# +# ELEMENTS +# +#Beam3d 1 nodes 2 5 6 refNode 1 crossSect 2 DofsToCondense 6 3 4 6 9 10 12 +#Beam2d 1 nodes 2 5 6 crossSect 2 +Truss2d 1 nodes 2 5 6 crossSect 2 cs 1 +PlaneStress2d 2 nodes 4 1 2 4 3 crossSect 1 +# +Set 1 nodes 1 1 +Set 2 nodes 1 3 +Set 3 nodes 1 2 +# +# CROSSECTION +# +SimpleCS 1 thick 1.0 width 1.0 material 1 +SimpleCS 2 area 1.e6 Iy 0.002343466 beamShearCoeff 1.e18 thick 0.54 material 2 +# +# +# MATERIAL +# +IsoLE 1 d 0. n 0.2 E 30.e3 talpha 0. +IsoLE 2 d 1. E 30.e6 n 0.2 tAlpha 0. +# +# +BoundaryCondition 1 loadTimeFunction 1 dofs 2 1 2 values 2 0. 0. set 1 +BoundaryCondition 2 loadTimeFunction 1 dofs 1 1 values 1 0. set 2 +# +NodalLoad 3 loadTimeFunction 1 dofs 2 1 2 components 2 1.0 1.0 set 3 +# +# +# TIME FUNCTION +# +ConstantFunction 1 f(t) 1.0 +# +#%BEGIN_CHECK% tolerance 5.e-3 +#ELEMENT tStep 1 number 1 gp 1 keyword 1 component 1 value 7.35062615e+02 +#ELEMENT tStep 1 number 3 gp 1 keyword 1 component 1 value 7.34992211e+02 +#%END_CHECK% diff --git a/tests/sm/steelRelaxMat_vtk_CM3.in b/tests/sm/steelRelaxMat_vtk_CM3.in new file mode 100644 index 000000000..e9c054751 --- /dev/null +++ b/tests/sm/steelRelaxMat_vtk_CM3.in @@ -0,0 +1,64 @@ +steelRelaxMat_CM3.out +relaxation of prestressing reinforcement, all dofs fixed +# +StaticStructural nsteps 2 prescribedTimes 2 0.0001 0.0002 nmodules 1 +# +#errorcheck +vtkxml tstep_step 1 domain_all vars 2 1 4 primvars 1 1 +# +domain 2dPlaneStress +# +OutputManager tstep_all dofman_all element_all +ndofman 6 nelem 2 ncrosssect 2 nmat 2 nbc 3 nic 0 nltf 1 nset 3 +# +# +# NODES +# +node 1 coords 2 0.0 0.0 +node 2 coords 2 1.0 0.0 +node 3 coords 2 0.0 1.0 +node 4 coords 2 1.0 1.0 +# +hangingNode 5 coords 3 0.0 0.5 0.0 dofType 3 2 2 2 masterElement 2 dofidmask 3 1 2 5 +hangingNode 6 coords 3 1.0 0.5 0.0 dofType 3 2 2 2 masterElement 2 dofidmask 3 1 2 5 +#hangingNode 5 coords 2 0.0 0.5 dofType 2 2 2 masterElement 2 dofidmask 2 1 2 +#hangingNode 6 coords 2 1.0 0.5 dofType 2 2 2 masterElement 2 dofidmask 2 1 2 +# +# +# ELEMENTS +# +#Beam3d 1 nodes 2 5 6 refNode 1 crossSect 2 DofsToCondense 6 3 4 6 9 10 12 +Beam2d 1 nodes 2 5 6 crossSect 2 cs 1 +#Truss2d 1 nodes 2 5 6 crossSect 2 cs 1 +PlaneStress2d 2 nodes 4 1 2 4 3 crossSect 1 +# +Set 1 nodes 1 1 +Set 2 nodes 1 3 +Set 3 nodes 1 2 +# +# CROSSECTION +# +SimpleCS 1 thick 1.0 width 1.0 material 1 +SimpleCS 2 area 0.000314159 Iy 7.85398163397448e-09 beamShearCoeff 0.83333 thick 0.02 material 2 +# +# +# MATERIAL +# +IsoLE 1 d 0. n 0.2 E 30.e6 talpha 0. +IsoLE 2 d 1. E 200.e6 n 0.3 tAlpha 0. +# +# +BoundaryCondition 1 loadTimeFunction 1 dofs 2 1 2 values 2 0. 0. set 1 +BoundaryCondition 2 loadTimeFunction 1 dofs 1 1 values 1 0. set 2 +# +NodalLoad 3 loadTimeFunction 1 dofs 2 1 2 components 2 1.0 1.0 set 3 +# +# +# TIME FUNCTION +# +ConstantFunction 1 f(t) 1.0 +# +#%BEGIN_CHECK% tolerance 5.e-3 +#ELEMENT tStep 1 number 1 gp 1 keyword 1 component 1 value 7.35062615e+02 +#ELEMENT tStep 1 number 3 gp 1 keyword 1 component 1 value 7.34992211e+02 +#%END_CHECK% diff --git a/tests/sm/steelRelaxMat_vtk_CM3_3D.in b/tests/sm/steelRelaxMat_vtk_CM3_3D.in new file mode 100644 index 000000000..ca2c9efbb --- /dev/null +++ b/tests/sm/steelRelaxMat_vtk_CM3_3D.in @@ -0,0 +1,69 @@ +steelRelaxMat_CM3_3D.out +relaxation of prestressing reinforcement, all dofs fixed +# +StaticStructural nsteps 2 prescribedTimes 2 0.0001 0.0002 nmodules 1 +# +#errorcheck +vtkxml tstep_step 1 domain_all vars 2 1 2 primvars 1 1 +# +domain 3d +# +OutputManager tstep_all dofman_all element_all +ndofman 10 nelem 2 ncrosssect 2 nmat 2 nbc 3 nic 0 nltf 1 nset 3 +# +# +# NODES +# +node 1 coords 3 0.0 0.0 0.0 +node 2 coords 3 1.0 0.0 0.0 +node 3 coords 3 1.0 1.0 0.0 +node 4 coords 3 0.0 1.0 0.0 +node 5 coords 3 0.0 0.0 1.0 +node 6 coords 3 1.0 0.0 1.0 +node 7 coords 3 1.0 1.0 1.0 +node 8 coords 3 0.0 1.0 1.0 +# +hangingNode 9 coords 3 0.0 0.5 0.5 dofType 6 2 2 2 2 2 2 masterElement 2 dofidmask 6 1 2 3 4 5 6 +hangingNode 10 coords 3 1.0 0.5 0.5 dofType 6 2 2 2 2 2 2 masterElement 2 dofidmask 6 1 2 3 4 5 6 +#hangingNode 5 coords 2 0.0 0.5 dofType 2 2 2 masterElement 2 dofidmask 2 1 2 +#hangingNode 6 coords 2 1.0 0.5 dofType 2 2 2 masterElement 2 dofidmask 2 1 2 +# +# +# ELEMENTS +# +Beam3d 1 nodes 2 9 10 crossSect 2 refNode 6 +#Beam2d 1 nodes 2 9 10 crossSect 2 +#Truss2d 1 nodes 2 5 6 crossSect 2 cs 1 +#Truss3d 1 nodes 2 5 6 crossSect 2 +lspace 2 nodes 8 1 2 3 4 5 6 7 8 crossSect 1 +# +Set 1 nodes 2 1 4 +Set 2 nodes 2 5 8 +Set 3 nodes 2 2 3 +# +# CROSSECTION +# +SimpleCS 1 thick 1.0 width 1.0 material 1 +SimpleCS 2 area 0.000314159 Iy 7.85398163397448e-09 Iz 7.85398163397448e-09 Ik 7.85398163397448e-09 beamShearCoeff 0.83333 thick 0.02 material 2 +# +# +# MATERIAL +# +IsoLE 1 d 0. n 0.2 E 30.e6 talpha 0. +IsoLE 2 d 1. E 200.e6 n 0.3 tAlpha 0. +# +# +BoundaryCondition 1 loadTimeFunction 1 dofs 2 1 2 values 2 0. 0. set 1 +BoundaryCondition 2 loadTimeFunction 1 dofs 1 1 values 1 0. set 2 +# +NodalLoad 3 loadTimeFunction 1 dofs 2 1 2 components 2 1.0 1.0 set 3 +# +# +# TIME FUNCTION +# +ConstantFunction 1 f(t) 1.0 +# +#%BEGIN_CHECK% tolerance 5.e-3 +#ELEMENT tStep 1 number 1 gp 1 keyword 4 component 1 value 7.35062615e+02 +#ELEMENT tStep 1 number 2 gp 1 keyword 4 component 1 value 7.34992211e+02 +#%END_CHECK%