Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
5ad2dd0
started working on a python implemetation.
npapnet Jan 24, 2024
d6fede6
Finished importing all the data from the files.
npapnet Jan 24, 2024
1236e0b
Completed Analysis convertion
npapnet Jan 25, 2024
f92b8f8
Added initial solution class.
npapnet Jan 25, 2024
aee886a
Corrected indexes for new transformation matrix
npapnet Jan 25, 2024
c8f2e0c
Testing transformation matrix (should cover the results of the analys…
npapnet Jan 26, 2024
8ca2806
Completed test with new displacement, force and global forces and dis…
npapnet Jan 26, 2024
d22fe61
converted Solve reactions.
npapnet Jan 26, 2024
a65c285
Added TrussPlotter Class
npapnet Jan 26, 2024
80d7878
Moved Truss_Plotter to a separate file.
npapnet Jan 26, 2024
b6ec70e
plots the truss with the elements and rollers
npapnet Jan 26, 2024
a2bcdf8
Added truss main
npapnet Jan 26, 2024
a95b71b
Added examples and documentation folder.
npapnet Jan 26, 2024
84a2ed5
Added examples and TODO file
npapnet Jan 26, 2024
cc79c0f
corrected problem in example_101.
npapnet Jan 27, 2024
433685a
Added a working implementation of the truss project.
npapnet Jan 27, 2024
734151e
Started package
npapnet Jan 27, 2024
41b56cc
Working version of the npp_2d_truss_analysis package.
npapnet Jan 27, 2024
2a55f81
Merge branch 'PythonPackage'
npapnet Jan 27, 2024
7a0f1b8
Updated TODO file.
npapnet Jan 27, 2024
bcf2ad7
Added json support for mesh and displacements.
npapnet Jan 27, 2024
0fed154
Added test for json forces.
npapnet Jan 28, 2024
10e8d16
Added a single json file version.
npapnet Jan 28, 2024
fee6a42
amended todo.md
npapnet Jan 28, 2024
71356e6
Added import in __init__.py of package root
npapnet Jan 28, 2024
dc1c62e
added magnitude in reaction forces.
npapnet Jan 28, 2024
06996c2
plot deformatio function
npapnet Jan 28, 2024
2aae61d
plot stress with elements
npapnet Jan 28, 2024
0798b20
using sub plot functions for rollers and forces to make code more com…
npapnet Jan 28, 2024
b8f912d
completed conversion of matlab code.
npapnet Jan 28, 2024
9be3f63
Added plotting for deformation and stresses directly in truss plotter.
npapnet Jan 29, 2024
225a50d
Added github workflow.
npapnet Jan 29, 2024
4271d38
Bumping up number to 0.1.1a0
npapnet Jan 29, 2024
e4ec9bd
Finish v0.1.1a
npapnet Jan 29, 2024
bfdd4f4
Finish v0.1.1a
npapnet Jan 29, 2024
8db7e57
added quick start rst
npapnet Jan 29, 2024
5a76f41
Bumped up version number to 0.1.1 (uploaded to pypi)
npapnet Jan 29, 2024
14745cf
Finish v0.1.1
npapnet Jan 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Deploy Documentation

on:
push:
branches:
- main # Replace with your default branch if it's not 'main'

jobs:
build-and-deploy:
runs-on: ubuntu-latest

steps:
- name: Check Out Repository
uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install sphinx

- name: Build Documentation
run: |
cd docs
make html

- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/build/html
25 changes: 25 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# directories
*/*.egg-info/
.ipynb_checkpoints/
Lectures/src/.vscode/
.vscode/



# latex
*.vrb
*.toc
*.snm
*.out
*.nav
*.gz
*.log
*.aux
*.glo
*.ist
*.acn
*.synctex(busy)
*.pyc
Lectures/*/*.pdf
/.pytest_cache/
/docs/build/
8 changes: 8 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"python.testing.pytestArgs": [
"src"
],
"python.testing.unittestEnabled": false,
"python.testing.pytestEnabled": true,
"esbonio.sphinx.confDir": ""
}
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,4 +138,5 @@ In example 2, all members properties are **E = 200 GPa** and **A = 0.0015 m^2^**

## Author

- Eduardo Pereira
- Eduardo Pereira (original MATLAB/GNU Octave version)
- Nikolaos Papadakis (Python implementation)
21 changes: 21 additions & 0 deletions TODO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

## TODO
- CLEANUP: Streamline code (use np.arrays for easier slicing etc)
- CLEANUP: plotter functions could use a lot of cleanup (i.e. move the Mesh, Displacement
and Solution objects into the _plot_functions)
- DOC: add documentation for all methods
- DOC: add documentation for classes
- DOC: add quickstart guide
- CLEANUP: use the roots __init__.py imports to simplify the import statements

## History
- 20240128|ORG: Upload package to Pypi
- 20240128|DOC: add documentation with example cases

- 20240128| ORG: USe single source of truth for versioning
- 20240128| FEATURE: complete conversion of PlotDeformation
- 20240128| FEATURE: complete conversion of PlotStress
- 20240128| FEATURE: Provide alternative ways to load data (e.g. json, directly with np.arrays)
- 20240127| ORG: Create a master class that performs seemleasly all the code (e.g. TrussProblem or similar).
- 20240127| ORG: Create a python package

20 changes: 20 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# 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 = source
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

# 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)
35 changes: 35 additions & 0 deletions docs/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
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
4 changes: 4 additions & 0 deletions docs/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
There are many problems that can be used for validation in

# https://mathalino.com/reviewer/engineering-mechanics/problem-004-mj-method-joints

6 changes: 6 additions & 0 deletions docs/source/background.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Truss Analysis Bakcground
=========================

This section is work in progress.

It will be used to explain the truss solving process.
64 changes: 64 additions & 0 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@

import os
import sys
sys.path.insert(0, os.path.abspath('../src'))

def get_version(rel_path):
"""Get the version string from a file.
Assuming the version line is in the form: __version__ = '0.1.0'
strips out the version and remove leading and trailing whitespace and quotes
Args:
rel_path (str): The relative path to the file.
Raises:
RuntimeError: If the version string is not found.

Returns:
str: The version string.
"""

with open(rel_path, 'r', encoding='utf-8') as fp:
for line in fp:
if line.startswith('__version__'):
delim = '"' if '"' in line else "'"
return line.split(delim)[1]
raise RuntimeError("Unable to find version string.")

PATH_TO_INIT_PY = '../../src/npp_2d_truss_analysis/__init__.py'

__version__ = get_version(PATH_TO_INIT_PY)

# 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 = 'NPP 2d Truss Analysis'
copyright = '2024, Nikolaos Papadakis'
author = 'Nikolaos Papadakis'
release = __version__

# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = []

templates_path = ['_templates']
exclude_patterns = []



# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output

html_theme = 'alabaster'
html_static_path = ['_static']



rst_epilog = """
.. |ProjectVersion| replace:: v{versionnum}
""".format(versionnum = release
)
25 changes: 25 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.. NPP 2d Truss Analysis documentation master file, created by
sphinx-quickstart on Mon Jan 29 09:58:27 2024.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.

Welcome to NPP 2d Truss Analysis's |ProjectVersion| documentation!
==================================================================

.. toctree::
:maxdepth: 2
:caption: Contents:

introduction
background
installation
tutorials/index



Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
42 changes: 42 additions & 0 deletions docs/source/installation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@

Installation/Setup
==================

Requirements
------------

The package depends on the following "standard" libraries:

- matplotlib
- scipy
- numpy


Conda Installation
------------------

The following describes a minimum environment setup using Conda.

(Optional) It is preferable to create a new environment for the packages:

.. code-block:: bash

conda create -n truss_analysis python=3

The installation requires:

- matplotlib
- scipy
- numpy

To install these packages, use the command:

.. code-block:: bash

conda install matplotlib scipy numpy

Then ton install the package, use the command:

.. code-block:: bash

pip install npp_2d_truss_analysis
20 changes: 20 additions & 0 deletions docs/source/introduction.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Introduction
------------

**npp_2d_truss_analysis** is an open-source software tool designed for the solving of trusses with features like:

- inclined roller supports
- offset pin supports
- prescribed displacements
- plotting of Truss problem (with geometry, loads and supports)
- deformation plotting
- forces and reaction plotting

Developers
----------

The python version of the truss analysis project has been developed by:

- N. Papadakis: In charge of software design and package maintenance.

the work is based on Eduaardo's Pereira's repoistory for matlab called [TrussAnalysis2d-MATLAB](https://github.com/edurodriper/TrussAnalysis2D-MATLAB).
18 changes: 18 additions & 0 deletions docs/source/tutorials/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Tutorials
=========

.. toctree::
:maxdepth: 2
:caption: Tutorials:

quickstart
tutorial_original_input
tutorial_json_input
tutorial_single_file_json


Additional things to consider:

- how to update input for forces

- plotting only truss without the solution
Loading