From e49c911524651b408fc18d4c557aa43eb5f2b442 Mon Sep 17 00:00:00 2001 From: iasonmanolas Date: Tue, 23 Mar 2021 11:51:35 +0200 Subject: [PATCH] Removed cmd.cpp --- CMakeLists.txt | 2 +- src/cmd.cpp | 93 -------------------------------------------------- 2 files changed, 1 insertion(+), 94 deletions(-) delete mode 100644 src/cmd.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index c3cfdfc..a10ac15 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -18,7 +18,7 @@ set(EXT_RAPIDJSON_ROOT ${CMAKE_CURRENT_LIST_DIR}/ext/rapidjson/include) set(EXT_TCLAP_ROOT ${CMAKE_CURRENT_LIST_DIR}/ext/tclap-1.2.1/include) #include_directories(${EXT_BOOST_ROOT}) -add_library(${PROJECT_NAME} src/cmd.cpp src/setup.cpp src/summary.cpp src/threed_beam_fea.cpp) +add_library(${PROJECT_NAME}#[[ src/cmd.cpp]] src/setup.cpp src/summary.cpp src/threed_beam_fea.cpp) target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include/ diff --git a/src/cmd.cpp b/src/cmd.cpp deleted file mode 100644 index ffe993b..0000000 --- a/src/cmd.cpp +++ /dev/null @@ -1,93 +0,0 @@ -// Copyright 2015. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are met: -// -// * Redistributions of source code must retain the above copyright notice, -// this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above copyright notice, -// this list of conditions and the following disclaimer in the documentation -// and/or other materials provided with the distribution. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE -// POSSIBILITY OF SUCH DAMAGE. -// -// Author: ryan.latture@gmail.com (Ryan Latture) - -#include -#include -#include "threed_beam_fea.h" -#include "setup.h" - -fea::Summary runAnalysis(const rapidjson::Document &config_doc) { - fea::Job job = fea::createJobFromJSON(config_doc); - - std::vector ties; - if (config_doc.HasMember("ties")) { - ties = fea::createTieVecFromJSON(config_doc); - } - - std::vector bcs; - if (config_doc.HasMember("bcs")) { - bcs = fea::createBCVecFromJSON(config_doc); - } - - std::vector forces; - if (config_doc.HasMember("forces")) { - forces = fea::createForceVecFromJSON(config_doc); - } - - std::vector equations; - if (config_doc.HasMember("equations")) { - equations = fea::createEquationVecFromJSON(config_doc); - } - - fea::Options options = fea::createOptionsFromJSON(config_doc); - - return fea::solve(job, bcs, forces, ties, equations, options); -} - -int main(int argc, char *argv[]) { - try { - TCLAP::CmdLine cmd("3D Euler-Bernoulli beam element FEA. " - "Use the -c [--config] flag to point to the configuration file for the current analysis.", - ' ', "1.0"); - TCLAP::ValueArg configArg("c", - "config", - "Finite element configuration file (json format). " - "Must have \"nodes\", \"elems\", and \"props\" members pointing the associated files. " - "Optionally, any boundary conditions should be in the file pointed to by " - "the \"bcs\" member variable of the config file. Likewise, prescribed " - "forces are set using the \"forces\" variable, and ties are set via the " - "\"ties\" variable. Please refer to the documentation for the file format " - "of each variable. Override the default options using the \"options\" " - "member variable the itself is a nested json object. Refer to the " - "fea::Options documentation the possible configurations that can be set.", - true, - "config.json", - "string"); - cmd.add(configArg); - cmd.parse(argc, argv); - std::string config_filename = configArg.getValue(); - rapidjson::Document config_doc = fea::parseJSONConfig(config_filename); - - runAnalysis(config_doc); - } - catch (TCLAP::ArgException &e) // catch any exceptions from parsing - { - std::cerr << "error: " << e.error() << " for arg " << e.argId() << std::endl; - } - catch (std::exception &e) { - std::cerr << "error: " << e.what() << std::endl; - } - return 0; -}