diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000000000000000000000000000000000000..506077f661e03f90a369aeab810eaef4ebd334a2 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,29 @@ + +CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0) +if( CMAKE_MAJOR_VERSION EQUAL 2 ) + if( CMAKE_MINOR_VERSION EQUAL 8 ) + if( CMAKE_PATCH_VERSION LESS 3 ) + message(WARNING "CMake version is inferior to 2.8.3, some features may not be well supported") + endif( CMAKE_PATCH_VERSION LESS 3 ) + endif( CMAKE_MINOR_VERSION EQUAL 8 ) +endif( CMAKE_MAJOR_VERSION EQUAL 2 ) + +# path to homemade/taken macros/finds +set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/src/tools/cmake/modules ${CMAKE_MODULE_PATH}) + +# Force out-of-source build +include(OutOfSourcesBuild) + +project(LMGC90_dev Fortran C CXX) + +SET(LMGC90_MAJOR_VERSION 2) +SET(LMGC90_MINOR_VERSION 0) +SET(LMGC90_PATCH_VERSION 0) + +MESSAGE(STATUS "You try to build LMGC90_dev") + + +include(CTest) + +add_subdirectory(src) + diff --git a/README.md b/README.md index 2c5d46e92b25f50f177facaaa9edf4ae9f3d4d8b..f3ce3c0ab0dfb6191789f8aa3d8f0661ef222446 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,21 @@ - - # LMGC90 project: user version # # Downloading -To get the project please check [here](https://git-xen.lmgc.univ-montp2.fr/lmgc90/lmgc90_user/wikis/download_and_install) +To get the project please check [here](https://git-xen.lmgc.univ-montp2.fr/lmgc90/lmgc90_user/wikis/home) + +# Contact us +If you'd like to speak about a bad behavior of a simulation, to propose a non +regression test, to propose a new feature or any thing relative to the +development of LMGC90, please contact us via this mailing list: + +lmgc90-dev@groupes.renater.fr + +To stay aware, you can subscribe to this mailing list by asking to: + - Dubois Frédéric : frederic.dubois@umontpellier.fr + - Rémy Mozul : remy.mozul@umontpellier.fr # Organization @@ -24,6 +33,14 @@ For Windows user, jump to [Windows Version section](#winversion) # Linux and MacOS version +# Versionning + +People contributing to the project can view up-to-date information +[here](https://git-xen.lmgc.univ-montp2.fr/lmgc90/lmgc90_user/tree/master) + +The versionning tool used is git. To have more information the workflow used +and how to use git check [there](https://git-xen.lmgc.univ-montp2.fr/lmgc90/lmgc90_user/wikis/LMGC90_user) + With MacOS and Linux the installation and use of LMGC90 software is through the use of the terminal. You must know how to open a terminal in a specific directory and move through your directory tree. @@ -59,11 +76,20 @@ For visualisation: * Python VTK module * Paraview +To build the sphinx documentation: + + * Latex distribution (with pdflatex utility) + * Sphinx and numpydoc + * Doxygen + * Graphviz + * dvipng + To read some tutorials: * Jupyter * iPython + ### Ubuntu 12.04/14.04 Debian 7 To compile: @@ -78,6 +104,12 @@ To visualize: apt-get install python-vtk paraview ``` +To build the documentation: + +``` +apt-get install doxygen graphviz python-numpydoc texlive-latex-extra dvipng imagemagick +``` + To read tutorials ``` @@ -105,6 +137,12 @@ Due to some problem one must add to the *.bashrc* file a line similar to: export LD_LIBRARY_PATH=/usr/lib64/mpi/gcc/openmpi/lib64 ``` +To build the documentation: + +``` +zypper install doxygen graphviz python-numpydoc texlive-dvipng ImageMagick +``` + To read tutorials ``` @@ -128,6 +166,12 @@ yum install epel-release yum install vtk-python paraview ``` +To build the documentation: + +``` +yum install doxygen graphviz tex-preview textlive-latex texlive-dvipng python-sphinx python-numpydoc ImageMagick +``` + To read tutorials ``` @@ -152,7 +196,7 @@ sudo port select gcc mp-gcc49 sudo port select python python27 ``` -For the doc: +To build the documentation: ``` doxygen graphviz py27-sphinx py27-numpydoc texlive-latex-extra dvipng ImageMagick @@ -176,10 +220,47 @@ In the *lmgc90_user* directory run: ```shell mkdir build cd build -cmake ../src +cmake .. +make +``` + +CMake is used to generate the makefile. Out of source build is advised. +So you need to know the source tree path, decide on a build path then: + +``` +cd build_path +cmake source_path make ``` +Instead of cmake, one can use *ccmake* to change variable values on +the command line, or *cmake-gui* to use graphical interface. + +If you are only interested in rigid computations, some external libraries +can be disabled ; before the ```make``` command, run: + +``` +cmake . -DMATLIB_VERSION=none -DMUMPS_VERSION=none +``` + +If you want to build the documentation run : + +``` +make docs +``` + +It will build the sphinx documentation in: + + * docs/chipy/ + * docs/dev/ + * docs/Pre/ + +Where you should open the ```index.html``` file. + +The doxygen documentation of the the core of the software would be in ```src/Docs/html/index.html```. + + + ## Installing Our policy is to not mess with default system paths. So instead we advise to @@ -234,7 +315,7 @@ in general. The only pre-requisite to use LMGC90 on Windows is the Python distribution used. A binary build is provided to work with the Anaconda python distribution -which can be downloaded from [here](https://repo.continuum.io/archive/.winzip/Anaconda2-2.5.0-Windows-x86_64.zip). +which can be downloaded from [here](https://repo.continuum.io/archive/.winzip/Anaconda2-2.5.0-Windows-x86.zip). Once the file downloaded, unzip it and run the installer. To generate visualization files the **vtk** python module must be added. To do that diff --git a/docs/Pre/.buildinfo b/docs/Pre/.buildinfo index be3e4219d25c4f8f2cc6f120f6c9f54dd43b830c..d2e57160bb194e8f5e3b4d65324e9de69bae453d 100644 --- a/docs/Pre/.buildinfo +++ b/docs/Pre/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: 7087fddd1fcf46ba6ed4e8ccea462539 +config: 18d4cbd131087e90d4cf97685dfe9ec3 tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/docs/Pre/_downloads/granular.py b/docs/Pre/_downloads/granular.py index 47266ae29662bf2335e903ff766c131aa5899c1c..16278b3f72bddf80f7e5ebcfb682a9e2e8a8f62d 100644 --- a/docs/Pre/_downloads/granular.py +++ b/docs/Pre/_downloads/granular.py @@ -1,6 +1,6 @@ import math -from pylmgc90.pre_lmgc import * +from pylmgc90.pre import * nb_particles = 10000 radius_min = 1.0 @@ -12,8 +12,8 @@ ly = 100. [nb_laid_particles, coors] = depositInBox2D(radii,lx,ly) -mat = material(name='TDURx', type='RIGID', density=100.) -mod = model(name='rigid', type='MECAx', element='Rxx2D', dimension=2) +mat = material(name='TDURx', materialType='RIGID', density=100.) +mod = model(name='rigid', physics='MECAx', element='Rxx2D', dimension=2) # generate the triangles bodies = avatars() @@ -24,7 +24,7 @@ for i in range(nb_laid_particles): max_radius = max(radii) -mut = material(name='TDURx', type='RIGID', density=1000.) +mut = material(name='TDURx', materialType='RIGID', density=1000.) # left wall : rough wall left = roughWall( center=[-radius_max, 0.5*ly], theta=-0.5*math.pi, l=ly + 2.*radius_max, @@ -55,7 +55,7 @@ svs = see_tables() tacts = tact_behavs() # interaction definition: -lplpl=tact_behav(name='iqsc0', type='IQS_CLB', fric=0.3) +lplpl=tact_behav(name='iqsc0', law='IQS_CLB', fric=0.3) tacts+=lplpl svplpl = see_table(CorpsCandidat='RBDY2', candidat='POLYG', colorCandidat='BLUEx', behav=lplpl, CorpsAntagoniste='RBDY2', antagoniste='POLYG', colorAntagoniste='BLUEx', alert=.1) diff --git a/docs/Pre/_downloads/masonry.py b/docs/Pre/_downloads/masonry.py index d3913f8685b054d468e9b0a13c3e58875a59adef..40f81f967fe61c5311604421dea94f2355139496 100644 --- a/docs/Pre/_downloads/masonry.py +++ b/docs/Pre/_downloads/masonry.py @@ -1,13 +1,13 @@ import numpy import math -from pylmgc90.pre_lmgc import * +from pylmgc90.pre import * dim = 2 bodies = avatars() -mat = material(name='PLEXx',type='RIGID',density=2000.) -mod = model(name='rigid', type='MECAx', element='Rxx2D', dimension=dim) +mat = material(name='PLEXx',materialType='RIGID',density=2000.) +mod = model(name='rigid', physics='MECAx', element='Rxx2D', dimension=dim) # bricks, half-brick, linteau and opening definition brick = brick2D('brick', 1.e-1, 5.e-2) @@ -71,7 +71,7 @@ mats = materials() svs = see_tables() tacts = tact_behavs() -mut = material(name='TDURx',type='RIGID',density=2500.) +mut = material(name='TDURx',materialType='RIGID',density=2500.) mats.addMaterial(mat,mut) floor = rigidJonc(axe1=3.e-1, axe2=2.5e-2, center=[2.5e-1, -2.5e-2], @@ -86,9 +86,9 @@ except: pass # interactions management : -lplpl=tact_behav(name='iqsc0',type='IQS_CLB',fric=0.3) +lplpl=tact_behav(name='iqsc0',law='IQS_CLB',fric=0.3) tacts+=lplpl -lpljc=tact_behav(name='iqsc1',type='IQS_CLB',fric=0.5) +lpljc=tact_behav(name='iqsc1',law='IQS_CLB',fric=0.5) tacts+=lpljc svbbbb = see_table(CorpsCandidat='RBDY2',candidat='POLYG', colorCandidat='BLEUx',behav=lplpl, CorpsAntagoniste='RBDY2', antagoniste='POLYG',colorAntagoniste='BLEUx',alert=5.e-3) diff --git a/docs/Pre/_downloads/philosophie.py b/docs/Pre/_downloads/philosophie.py index b9de7dcc2164b215ddad79c7cf9b4dbad4c5cfda..3c0103f2ece2ce7eb9bd8b7bfbff828c3c0e6ae9 100644 --- a/docs/Pre/_downloads/philosophie.py +++ b/docs/Pre/_downloads/philosophie.py @@ -1,30 +1,30 @@ import numpy import math -from pylmgc90.pre_lmgc import * +from pylmgc90.pre import * dim = 2 # disk creation radius = 0.1 -disk = avatar(type='RBDY2', dimension=dim) -disk.addNode( node(type='NO2xx',coor=numpy.array([0.,0.1]),number=1) ) +disk = avatar(dimension=dim) +disk.addNode( node(coor=numpy.array([0.,0.1]),number=1) ) disk.addBulk( rigid2d() ) disk.defineGroups() -disk.addContactors(type='DISKx',color='BLUEx',byrd=radius) +disk.addContactors(shape='DISKx',color='BLUEx',byrd=radius) # foundation creation -floor = avatar(type='RBDY2', dimension=dim) -floor.addNode( node(type='NO2xx',coor=numpy.array([0.,-0.05]),number=1) ) +floor = avatar(dimension=dim) +floor.addNode( node(coor=numpy.array([0.,-0.05]),number=1) ) floor.addBulk( rigid2d() ) floor.defineGroups() -floor.addContactors(type='JONCx',color='BLUEx',axe1=1.,axe2=0.05) +floor.addContactors(shape='JONCx',color='BLUEx',axe1=1.,axe2=0.05) # materials, model and groups definition -mat = material(name='TDURx',type='RIGID',density=1000.) -mut = material(name='MOUxx',type='RIGID',density=100.) -mod = model(name='rigid', type='MECAx', element='Rxx2D', dimension=dim) +mat = material(name='TDURx',materialType='RIGID',density=1000.) +mut = material(name='MOUxx',materialType='RIGID',density=100.) +mod = model(name='rigid', physics='MECAx', element='Rxx2D', dimension=dim) disk.defineModel(model=mod) disk.defineMaterial(material=mut) disk.computeRigidProperties() @@ -56,7 +56,7 @@ for i in range(nb_columns): # adding floor and rotation sample bodies.addAvatar(floor) -bodies.rotate(type='axis', alpha=-math.pi/6., axis=[0., 0., 1.], center=[1.,-0.05]) +bodies.rotate(description='axis', alpha=-math.pi/6., axis=[0., 0., 1.], center=[1.,-0.05]) try: visuAvatars(bodies) @@ -70,7 +70,7 @@ svs = see_tables() tacts = tact_behavs() # interaction definition: -ldkjc=tact_behav(name='iqsc0', type='IQS_CLB', fric=0.3) +ldkjc=tact_behav(name='iqsc0', law='IQS_CLB', fric=0.3) tacts+=ldkjc svdkjc = see_table(CorpsCandidat='RBDY2', candidat='DISKx', colorCandidat='BLUEx', behav=ldkjc, CorpsAntagoniste='RBDY2', antagoniste='JONCx', colorAntagoniste='BLUEx', alert=.1) diff --git a/docs/Pre/_images/math/034415649a7db35f209020f05e7ab6ac3d6e086b.png b/docs/Pre/_images/math/034415649a7db35f209020f05e7ab6ac3d6e086b.png deleted file mode 100644 index fe812875f214753e4dc87f422cb924915056cae7..0000000000000000000000000000000000000000 Binary files a/docs/Pre/_images/math/034415649a7db35f209020f05e7ab6ac3d6e086b.png and /dev/null differ diff --git a/docs/Pre/_images/math/2ea7aebf6e172bdbb4b352fe0520f84304f478e7.png b/docs/Pre/_images/math/2ea7aebf6e172bdbb4b352fe0520f84304f478e7.png new file mode 100644 index 0000000000000000000000000000000000000000..587ddf3fa694896842853d5851ddd83302299b98 Binary files /dev/null and b/docs/Pre/_images/math/2ea7aebf6e172bdbb4b352fe0520f84304f478e7.png differ diff --git a/docs/Pre/_images/math/389ab841ae16a7cebd461d3c10bda5daa9b232a2.png b/docs/Pre/_images/math/389ab841ae16a7cebd461d3c10bda5daa9b232a2.png deleted file mode 100644 index 031b1f61f9d0ddfc23211fcab38c83624300e8e2..0000000000000000000000000000000000000000 Binary files a/docs/Pre/_images/math/389ab841ae16a7cebd461d3c10bda5daa9b232a2.png and /dev/null differ diff --git a/docs/Pre/_images/math/667188468983fb96809cdfaec211b867038325ef.png b/docs/Pre/_images/math/667188468983fb96809cdfaec211b867038325ef.png deleted file mode 100644 index 7a247b6e7e1680c70536955ac39720c2e4a64f01..0000000000000000000000000000000000000000 Binary files a/docs/Pre/_images/math/667188468983fb96809cdfaec211b867038325ef.png and /dev/null differ diff --git a/docs/Pre/_images/math/a6795d14a31aa864e162da06bcc14d9801cbdc11.png b/docs/Pre/_images/math/a6795d14a31aa864e162da06bcc14d9801cbdc11.png new file mode 100644 index 0000000000000000000000000000000000000000..b87f7eda16af2c7e0e4d1b0643527aa53f2e89e0 Binary files /dev/null and b/docs/Pre/_images/math/a6795d14a31aa864e162da06bcc14d9801cbdc11.png differ diff --git a/docs/Pre/_images/math/b39229bb92adf679ebe7aa3a58f330b21d6ed3d5.png b/docs/Pre/_images/math/b39229bb92adf679ebe7aa3a58f330b21d6ed3d5.png new file mode 100644 index 0000000000000000000000000000000000000000..8507e989301b4e24fdeebea8d0e6ac322a9429f8 Binary files /dev/null and b/docs/Pre/_images/math/b39229bb92adf679ebe7aa3a58f330b21d6ed3d5.png differ diff --git a/docs/Pre/_images/math/b425d925f1283bab52dde13193ba99f3de20e162.png b/docs/Pre/_images/math/b425d925f1283bab52dde13193ba99f3de20e162.png new file mode 100644 index 0000000000000000000000000000000000000000..2cad59e1aa1a722d76aebc26b40d8efb25566129 Binary files /dev/null and b/docs/Pre/_images/math/b425d925f1283bab52dde13193ba99f3de20e162.png differ diff --git a/docs/Pre/_images/math/cb4e1cb31029f79454cae98fb73221ca8662ea5b.png b/docs/Pre/_images/math/cb4e1cb31029f79454cae98fb73221ca8662ea5b.png new file mode 100644 index 0000000000000000000000000000000000000000..38d7d5bc966f44f881013cad97c45c5bee7b376f Binary files /dev/null and b/docs/Pre/_images/math/cb4e1cb31029f79454cae98fb73221ca8662ea5b.png differ diff --git a/docs/Pre/_images/math/d7f19ed033c8c88a6b4e5c502fe8271c336f971a.png b/docs/Pre/_images/math/d7f19ed033c8c88a6b4e5c502fe8271c336f971a.png deleted file mode 100644 index 031b1f61f9d0ddfc23211fcab38c83624300e8e2..0000000000000000000000000000000000000000 Binary files a/docs/Pre/_images/math/d7f19ed033c8c88a6b4e5c502fe8271c336f971a.png and /dev/null differ diff --git a/docs/Pre/_images/math/ddbf765aa11044bb82b756cb3413f75341a70edf.png b/docs/Pre/_images/math/ddbf765aa11044bb82b756cb3413f75341a70edf.png deleted file mode 100644 index fe812875f214753e4dc87f422cb924915056cae7..0000000000000000000000000000000000000000 Binary files a/docs/Pre/_images/math/ddbf765aa11044bb82b756cb3413f75341a70edf.png and /dev/null differ diff --git a/docs/Pre/_images/math/dea7f64cf4bcd7736b969f26733210c014965bc2.png b/docs/Pre/_images/math/dea7f64cf4bcd7736b969f26733210c014965bc2.png new file mode 100644 index 0000000000000000000000000000000000000000..2cad59e1aa1a722d76aebc26b40d8efb25566129 Binary files /dev/null and b/docs/Pre/_images/math/dea7f64cf4bcd7736b969f26733210c014965bc2.png differ diff --git a/docs/Pre/_images/math/ec6a660dca89c326a9f6d7a6ee1caf28c29025c9.png b/docs/Pre/_images/math/ec6a660dca89c326a9f6d7a6ee1caf28c29025c9.png deleted file mode 100644 index e5f4bd03ae7fa2564d57568118eb01b880934224..0000000000000000000000000000000000000000 Binary files a/docs/Pre/_images/math/ec6a660dca89c326a9f6d7a6ee1caf28c29025c9.png and /dev/null differ diff --git a/docs/Pre/_images/math/f577ce5d55c8fcd63b7fdb0ac8a27d2550e1ede8.png b/docs/Pre/_images/math/f577ce5d55c8fcd63b7fdb0ac8a27d2550e1ede8.png deleted file mode 100644 index 72c7557a9133c939b951c91030debcfdd52f2de2..0000000000000000000000000000000000000000 Binary files a/docs/Pre/_images/math/f577ce5d55c8fcd63b7fdb0ac8a27d2550e1ede8.png and /dev/null differ diff --git a/docs/Pre/_modules/index.html b/docs/Pre/_modules/index.html index fb3db01f38a1a89d97cbbf346b1e1bcc4ff57793..011ac3895e1acf058f53b72329a2e46b336435cd 100644 --- a/docs/Pre/_modules/index.html +++ b/docs/Pre/_modules/index.html @@ -45,36 +45,36 @@

All modules for which code is available

-
@@ -85,8 +85,8 @@ \ No newline at end of file diff --git a/docs/Pre/_modules/pylmgc90/pre_lmgc/files/evolutionFile.html b/docs/Pre/_modules/pylmgc90/pre/IO/evolution2File.html similarity index 76% rename from docs/Pre/_modules/pylmgc90/pre_lmgc/files/evolutionFile.html rename to docs/Pre/_modules/pylmgc90/pre/IO/evolution2File.html index f6a16ec47447639d82889a7256d83ebf3f9c34c4..859d23bafe1d249f88d6c15f33955344ea698e66 100644 --- a/docs/Pre/_modules/pylmgc90/pre_lmgc/files/evolutionFile.html +++ b/docs/Pre/_modules/pylmgc90/pre/IO/evolution2File.html @@ -6,7 +6,7 @@ - pylmgc90.pre_lmgc.files.evolutionFile — pylmgc90.pre 2015.2 documentation + pylmgc90.pre.IO.evolution2File — pylmgc90.pre 2015.2 documentation @@ -46,24 +46,26 @@
-

Source code for pylmgc90.pre_lmgc.files.evolutionFile

+  

Source code for pylmgc90.pre.IO.evolution2File

 # module gerant l'ecriture du fichier d'evolution pour l'application des conditions limites
 import os
-from pylmgc90.pre_lmgc.utilities.error    import *
+from pylmgc90.pre.utilities.error    import *
 
-
[docs]def writeEvolution(f, instants, path='', name='evolution.dat'): - """writeEvolution(f, instants, path='', name='evolution.dat'): - this function writes an evolution file used to apply - specific boundary conditions. - parameters: - - f: a function of time - - instants: for each instant t in the list, the function - f is evaluated and the couple (t, f(t)) is write - in the file - optional parameters: - - path='': path to the direactory where to write the evolution - file - - name='evolution.dat': name of the evolution file""" +
[docs]def writeEvolution(f, instants, path='', name='evolution.dat'): + """ + this function writes an evolution file used to apply specific boundary conditions. + parameters: + ----------- + - f: a function of time + - instants: for each instant t in the list, the function + f is evaluated and the couple (t, f(t)) is write in the file + + optional parameters: + -------------------- + - path='': path to the direactory where to write the evolution file + - name='evolution.dat': name of the evolution file + + """ # on verifie que la fonction donnee est bien appelable if not callable(f): @@ -92,8 +94,8 @@ \ No newline at end of file diff --git a/docs/Pre/_modules/pylmgc90/pre_lmgc/avatar/avatar.html b/docs/Pre/_modules/pylmgc90/pre/avatar/avatar.html similarity index 87% rename from docs/Pre/_modules/pylmgc90/pre_lmgc/avatar/avatar.html rename to docs/Pre/_modules/pylmgc90/pre/avatar/avatar.html index 7c8b281fcf14d11ef53739d6d91ecfe8dea830bd..58c5fc1dc3a09bf62ffb782ddcca75627708e30f 100644 --- a/docs/Pre/_modules/pylmgc90/pre_lmgc/avatar/avatar.html +++ b/docs/Pre/_modules/pylmgc90/pre/avatar/avatar.html @@ -6,7 +6,7 @@ - pylmgc90.pre_lmgc.avatar.avatar — pylmgc90.pre 2015.2 documentation + pylmgc90.pre.avatar.avatar — pylmgc90.pre 2015.2 documentation @@ -46,7 +46,7 @@
-

Source code for pylmgc90.pre_lmgc.avatar.avatar

+  

Source code for pylmgc90.pre.avatar.avatar

 import sys
 import numpy
 import math
@@ -60,35 +60,35 @@
 from contactors import *
 from groups import *
 from group import group
-from pylmgc90.pre_lmgc.config.lmgc90dicts import *
-from pylmgc90.pre_lmgc.utilities.error    import *
+from pylmgc90.pre.config.lmgc90dicts import *
+from pylmgc90.pre.utilities.error    import *
 
 # pour la verification des types (modele et materiau)
-from pylmgc90.pre_lmgc.shared.bulk_behav import material as class_material
-from pylmgc90.pre_lmgc.shared.model import model as class_model
+from pylmgc90.pre.shared.bulk_behav import material as class_material
+from pylmgc90.pre.shared.model import model as class_model
 
 from contactor.contactorFactory import contactorFactory
 
-from pylmgc90.pre_lmgc.build_avatar.mesh import mesh as class_mesh
+from pylmgc90.pre.build_avatar.mesh import mesh as class_mesh
 
 ## @class avatar
 # attributs:  \n
+#   atype is a string describing the numerical spatial discretization\n
 #   nodes is a node iterator with number as key\n
 #   bulks is a bulk iterator with number as key\n
 #   contactors is a contactor iterator with number as key\n
 #   groups is a group iterator with number as key\n
-
[docs]class avatar: +
[docs]class avatar(): ## constructor - def __init__(self, type, dimension, number=None): - """__init__(self, type, dimension, number=None): + def __init__(self, dimension, number=None): + """__init__(self, dimension, number=None): allow to define an avatar parameters: - self: the avatar itself - - type: type of the avatar - dimension: spatial dimension (2, in 2D, 3 in 3D) optional parameters: @@ -104,18 +104,7 @@ # un nouveau container) self.number = None - # si on reconnait le type de corps - if type in listeBodyType: - # on le stocke - self.type = type - # sinon, - else: - # on construit un message d'erreur rappelant les types disponibles - msg = "Type de corps inconnu\n le type doit etre choisi dans:\n" - for i in listeBodyType: - msg+=i+'\n' - # on l'affiche - showError(msg) + self.atype = None # am : ajout de la notion de dimension, pour la gestion des mailles # si la dimension est impossible @@ -123,18 +112,6 @@ # on affiche un message d'erreur showError("spatial dimension must be 2 (in 2D) or 3 (in 3D)!") - # verification de la compatibilite du type de corps avec la dimension - # * cas du rigide 2D - # si on demande un avatar rigide 2D, et qu'on est pas en 2D - if self.type == 'RBDY2' and dimension != 2: - # on affiche un message d'erreur - showError("RBDY2 avatars are only available in 2D!") - # * cas du rigide 3D - # si on demande un avatar rigide 3D, et qu'on est pas en 3D - if self.type == 'RBDY3' and dimension != 3: - # on affiche un message d'erreur - showError("RBDY3 avatars are only available in 3D!") - # si tous les tests sur la dimension ont reussi, on la stocke self.dimension = dimension @@ -149,7 +126,7 @@ ## add one node # @arg Noeud a node -
[docs] def addNode(self,Noeud): +
[docs] def addNode(self,Noeud): """ Usage : avatar.addNode(noeud) where noeud is a node object @@ -162,7 +139,7 @@ ## add nodes of an iterator # @arg Noeuds node iterator -
[docs] def addNodes(self,Noeuds): +
[docs] def addNodes(self,Noeuds): """ Usage : avatar.addNodes(noeuds) where noeuds is a node iterator @@ -173,7 +150,7 @@ ## add one bulk # @arg Ele a bulk # @todo : check that bulk type matches avatar type -
[docs] def addBulk(self,Ele): +
[docs] def addBulk(self,Ele): """ Usage : avatar.addBulk(Ele) where Ele is a bulk @@ -186,11 +163,41 @@ # l'avatar auquel il appartient Ele.number=len(self.bulks) # on l'ajoute dans le container de bulks de l'avatar - self.bulks.addBulk(Ele)
+ self.bulks.addBulk(Ele) + if isinstance(Ele,rigid2d): + + if self.dimension != 2: + showError("Trying to assign a rigid 2D element to a 3D avatar!") + + if self.atype is None: + self.atype = 'RBDY2' + else: + if self.atype=='MAILx': + showError("Trying to assign a rigid 2D element to a meshed avatar!") + + elif isinstance(Ele,rigid3d): + + if self.dimension != 3: + showError("Trying to assign a rigid 3D element to a 2D avatar!") + + if self.atype is None: + self.atype = 'RBDY3' + else: + if self.atype=='MAILx': + showError("Trying to assign a rigid 3D element to a meshed avatar!") + + elif isinstance(Ele,element): + + if self.atype is None: + self.atype = 'MAILx' + else: + if self.atype!='MAILx': + showError("Trying to assign a finite element to a rigid avatar!")
+ ## add bulks of an iterator # @arg Eles bulks iterator -
[docs] def addBulks(self,Eles): +
[docs] def addBulks(self,Eles): """ Usage : avatar.addBulks(Eles) where Eles is a bulk iterator @@ -221,7 +228,7 @@ self.contactors.addContactor(tact) # methode qui calcule les proprietes specifiques d'un corps rigide : masse, inertie et position du centre de gravite -
[docs] def computeRigidProperties(self): +
[docs] def computeRigidProperties(self): """computeRigidProperties(self): this function computes rigid properties of a rigid avatar : mass, inertia and mass center, from the contactors @@ -232,7 +239,7 @@ """ # si l'avatar n'est pas rigide - if self.type != 'RBDY2' and self.type != 'RBDY3': + if self.atype != 'RBDY2' and self.atype != 'RBDY3': # il n'est pas concerne par cette fonction showWarning("skipping deformable body") # on quitte la fonction @@ -262,7 +269,7 @@ # ici, on a affaire a un rigide bien defini # si l'avatar est un rigide 2D - if self.type == 'RBDY2': + if self.atype == 'RBDY2': # on cherche si on doit recalculer la position du centre d'inertie # on suppose initialement qu'il n'y a pas a la recalculer @@ -294,7 +301,7 @@ #fd # si le seul contacteur porte par l'objet est un point - if self.contactors[0].type == 'PT2Dx': + if self.contactors[0].shape == 'PT2Dx': # on indique que ca n'a pas de sens msg = "Attention pour le RBDY2 " + str(self.number) + " frontiere 1\n" msg += "Vous avez defini un seul contacteur de type point\n" @@ -366,7 +373,7 @@ self.bulks[0].gyrd = math.sqrt(I/area) # si l'avatar est un rigide 3D - if self.type == 'RBDY3': + if self.atype == 'RBDY3': # on cherche si on doit recalculer la position du centre d'inertie # on suppose initialement qu'il n'y a pas a la recalculer @@ -393,7 +400,7 @@ # absolu et pas dans le repere barycentrique # si le seul contacteur porte par l'objet est un point - if self.contactors[0].type == 'PT3Dx': + if self.contactors[0].shape == 'PT3Dx': msg = "Attention pour le RBDY3 " + str(self.number) + " frontiere 1\n" msg += "Vous avez defini un seul contacteur de type point\n" msg += "Ce contacteur ne contribue pas au calcul de la surface et de l'inertie de l'objet\n" @@ -520,7 +527,7 @@ # fonction qui verifie que tous les elements d'un avatar sont associes # a un modele et un element -
[docs] def checkModelAndMaterialDefinitions(self): +
[docs] def checkModelAndMaterialDefinitions(self): """checkModelAndMaterialDefinitions(self): this functions checks if all volumic (or surfacic, in 2D) elements of the given avatar @@ -536,7 +543,7 @@ # pour chaque element de l'avatar for ele in self.bulks: # si l'element est suppose porter un modele et un materiau - if ele.type in dimension2geoElement[self.dimension]: + if ele.etype in dimension2geoElement[self.dimension]: # si l'element ne porte pas de modele if ele.model == None: # on indique que tous les elements ne portent pas un modele @@ -555,12 +562,12 @@ # on parcours les groupes de l'avatar for group in self.groups.keys(): # si l'avatar est maille, on laisse tomber le groupe "all" - if self.type == "MAILx" and group == "all": + if self.atype == "MAILx" and group == "all": continue # on parcours les elements du groupe courant for ele in self.groups[group].bulks: # si l'element est suppose porter un modele et n'en porte pas - if ele.type in dimension2geoElement[self.dimension] and ele.model == None: + if ele.etype in dimension2geoElement[self.dimension] and ele.model == None: # on a trouve un groupe qui ne porte de modele # et on construit un message d'erreur pour prvenir l'utilisateur showError("bulks belonging to group \"" + group + "\" are not associated to any model!") @@ -570,12 +577,12 @@ # on parcours les groupes de l'avatar for group in self.groups.keys(): # si l'avatar est maille, on laisse tomber le groupe "all" - if self.type == "MAILx" and group == "all": + if self.atype == "MAILx" and group == "all": continue # on parcours les elements du groupe courant for ele in self.groups[group].bulks: # si l'element est suppose porter un materiau et n'en porte pas - if ele.type in dimension2geoElement[self.dimension] and ele.material == None: + if ele.etype in dimension2geoElement[self.dimension] and ele.material == None: # on a trouve un groupe qui ne porte de materiau # et on construit un message d'erreur pour prvenir l'utilisateur showError("bulks belonging to group \"" + group + "\" are not associated to any material!")
@@ -583,7 +590,7 @@ # ca doit appeler une routine dans nodes ## translate an avatar # @param dx,dy, dz tranlation vector -
[docs] def translate(self,dx=0.,dy=0.,dz=0.): +
[docs] def translate(self,dx=0.,dy=0.,dz=0.): """ usage self.tranlsate(dx=0.,dy=0.,dz=0.) where dx,dy, dz are components of translation vector @@ -591,8 +598,18 @@ for no in self.nodes: no.translate(dx=dx,dy=dy,dz=dz)
-
[docs] def rotate(self, type='Euler', phi=0., theta=0., psi=0., alpha=0., axis=[0., 0., 1.], center=[0., 0., 0.]): - """ rotate(self, type='Euler', phi=0., theta=0., psi=0., alpha=0., axis=[0., 0., 1.], center=[0., 0., 0.]) + ## scale an avatar + # @param scale +
[docs] def scale(self,scale=1.0): + """ usage self.scale(scale = 1.0) + + where scale is the scale + """ + for no in self.nodes: + no.scale(scale=scale)
+ +
[docs] def rotate(self, description='Euler', phi=0., theta=0., psi=0., alpha=0., axis=[0., 0., 1.], center=[0., 0., 0.]): + """ rotate(self, description='Euler', phi=0., theta=0., psi=0., alpha=0., axis=[0., 0., 1.], center=[0., 0., 0.]) this function rotates the considered avatar, according to the given rotation parameters and a rotation center. Supported rotation paramters are: Euler's angles or an axis and an angle @@ -600,11 +617,11 @@ parameters: - self: the avatar itself - - type='Euler': type defines the rotation parameters: + - description='Euler': defines the rotation parameters: - - if type = 'Euler', the rotation uses Euler's angles, consequently only phi, theta, psi and + - if description = 'Euler', the rotation uses Euler's angles, consequently only phi, theta, psi and center are considered - - if type = 'axis', the rotation uses an axis and an angle, consequently only axis, alpha and + - if description = 'axis', the rotation uses an axis and an angle, consequently only axis, alpha and center are considered - phi: first Euler's angle (rotation with respect to z-axis) - theta: second Euler's angle (rotation with respect to x-axis) @@ -616,7 +633,7 @@ N.B. all angles are in radians """ # selon la parametrisation utilisee - if type == 'Euler': # cas des angles d'Euler + if description == 'Euler': # cas des angles d'Euler # test de coherence if (self.dimension == 2 and (phi != 0. or theta != 0.)): showError('in 2D only psi should be defined (rotation around z axis)') @@ -633,7 +650,7 @@ [0., 0., 1.]],'d') q = numpy.dot(numpy.dot(q1,q2),q3) - elif type == 'axis': # cas ou on donne un axe de rotation + elif description == 'axis': # cas ou on donne un axe de rotation # tests de coherence : # * taille du vecteur if numpy.size(axis) != 3: @@ -680,7 +697,7 @@ self.imposeInitValue()
# fonction qui transforme l'objet en son symetrique par rapport a un plan -
[docs] def mirror(self, n, center, atol=1.e-8): +
[docs] def mirror(self, n, center, atol=1.e-8): """mirror(slef, n, center, atol=1.e-8): this function changes an avatar to its symmetrical through the @@ -774,7 +791,7 @@ showError('mirror :: unknown bulk type!')
# fonction qui cherche un noeud dans l'avatar, a partir de ces coordonnees -
[docs] def findNode(self, coor, atol=1.e-8): +
[docs] def findNode(self, coor, atol=1.e-8): """findNode(self, n, atol=1.e-8): this function return the index of the node which coordinates are @@ -828,7 +845,7 @@ # # # -
[docs] def defineGroups(self): +
[docs] def defineGroups(self): # A REVOIR L ENDROIT DE LA DEFINITION DES GROUPES """defineGroups(self) @@ -845,7 +862,7 @@ self.groups['all'].addNode(node) # test pour savoir si on est bien un MAILx - if (self.type != 'MAILx'): + if (self.atype != 'MAILx'): # fd affichage casse burne <- une variable de bavardage ? # print 'Only the group all will be defined' return @@ -854,13 +871,13 @@ listeTypeElement = [] for bulk in self.bulks: - if bulk.type not in listeTypeElement: - listeTypeElement.append(bulk.type) - self.groups.addGroup(group.group(bulk.type)) + if bulk.etype not in listeTypeElement: + listeTypeElement.append(bulk.etype) + self.groups.addGroup(group.group(bulk.etype)) - self.groups[bulk.type].addBulk(bulk) + self.groups[bulk.etype].addBulk(bulk) for j in bulk.connectivity: - self.groups[bulk.type].addNode(self.nodes[j]) + self.groups[bulk.etype].addNode(self.nodes[j]) if bulk.physicalEntity not in listeGroupes: self.groups.addGroup(group.group(bulk.physicalEntity)) @@ -871,7 +888,7 @@ self.groups[bulk.physicalEntity].addNode(self.nodes[j])
# fonction qui inidque si un groupe appartient a un avatar ou non -
[docs] def hasGroup(self, group): +
[docs] def hasGroup(self, group): """hasGroup(self,group): this functions return "True" iff the given group belongs to the given avatar @@ -879,7 +896,7 @@ return (group in self.groups.keys())
## setting model -
[docs] def defineModel(self,group='all',model=None): +
[docs] def defineModel(self,group='all',model=None): """defineModel(self,group='all',model=None) match a model (class model) or a set of models (class model) to a group @@ -907,17 +924,17 @@ # si l'element fini est incomptible avec l'avatar # * cas de l'element fini classique avec un rigide # si on refile un modele base sur element fini classique a un avatar rigide - if (self.type == 'RBDY2' or self.type == 'RBDY3') and not model.element in rigidElements: + if (self.atype == 'RBDY2' or self.atype == 'RBDY3') and not model.element in rigidElements: # on affiche un message d'erreur showError("a standard finite element cannot be handled by a rigid avatar!") # si on refile un element fini rigide a un avatar deformable - if self.type == 'MAILx' and model.element in rigidElements: + if self.atype == 'MAILx' and model.element in rigidElements: # on affiche un message d'erreur showError("a rigid finite element cannot be handled by a meshed avatar!") # si un modele a deja ete affecte a une partie des elements de l'avatar # et que le modele qu'on s'apprete a affecter est d'un type different - if self.modelType != None and model.type != self.modelType: + if self.modelType != None and model.physics != self.modelType: # on affiche un message d'erreur showError("Different types of models cannot be associated to the same avatar!") @@ -953,11 +970,11 @@ showError(msg) # on garde le type de model associe a l'avatar - self.modelType = model.type
+ self.modelType = model.physics
## set the material of an element # -
[docs] def defineMaterial(self,group='all',material=None): +
[docs] def defineMaterial(self,group='all',material=None): """ defineMaterial(self,group='all',material=None) associate a material or a material container to the element @@ -983,7 +1000,7 @@ # ici, on est sur que le materiau est un objet de type material # si le materiau est defini en externe (i.e. un USER_MAT) - if material.type == 'USER_MAT': + if material.materialType == 'USER_MAT': # on affiche un message inidquant que les tests de coherence materiau/modele sont desactives showWarning("Consistancy tests will not be performed since the given material is user defined!") @@ -1017,20 +1034,20 @@ ## build a string to represent the avatar def __str__(self): - impr ='avatar number : %10s of type %5s' %(self.number, self.type) + impr ='avatar number : %10s of type %5s' %(self.number, self.atype) return impr ## add contactors # @arg Tact a contactor -
[docs] def addContactors(self,type,color,group='all',**options): - """addContactors(self,type,color,group='all',**options) +
[docs] def addContactors(self,shape,color,group='all',**options): + """addContactors(self,shape,color,group='all',**options) define contactors for the elements of a group parameters: - self: the contactor itself - - type: type of the contactors + - shape: type of the contactors - color: color of the contactor optional parameters: @@ -1044,7 +1061,7 @@ showError('group: ' + group + ' do not belong to this avatar!') # si la dimension du contacteur differe de celle de l'avatar - if not type in dimension2contactor[self.dimension]: + if not shape in dimension2contactor[self.dimension]: # on construit un message d'erreur rappelant les types disponibles msg = "Type de contacteur inutilisable en " + str(self.dimension) + "D\n les contacteurs utilisables en " + str(self.dimension) + "D sont:\n" for i in dimension2contactor[self.dimension]: @@ -1055,7 +1072,7 @@ # si le type de contacteur est incomptible avec l'avatar # * cas du contaceur element fini avec un rigide # si on refile un contacteur base sur element fini a un avatar rigide - if (self.type == 'RBDY2' or self.type == 'RBDY3') and not type in rigidContactor: + if (self.atype == 'RBDY2' or self.atype == 'RBDY3') and not shape in rigidContactor: # on construit un message d'erreur rappelant les types disponibles msg = "Type de contacteur inutilisable avec un avatar rigide\n les contacteurs utilisables avec un avatar rigide sont:\n" for i in rigidContactor: @@ -1064,7 +1081,7 @@ showError(msg) # * cas du contaceur rigide (autre que le POLYD) avec un maillage element fini # si on refile un contacteur rigide a un avatar deformable - if self.type == 'MAILx' and type in rigidContactor: + if self.atype == 'MAILx' and shape in rigidContactor: # on construit un message d'erreur rappelant les types disponibles msg = "Type de contacteur inutilisable avec un avatar maille\n les contacteurs utilisables avec un avatar maille sont:\n" for i in listeContactor: @@ -1077,7 +1094,7 @@ cles = options.keys() # si le contacteur est une ligne ou une surface candidtate - if type == 'CLxxx' or type == 'CSxx3' or type == 'CSxx4': + if shape == 'CLxxx' or shape == 'CSxx3' or shape == 'CSxx4': # si on ne donne pas de poids pour placer le contacteur if 'weights' not in cles: # on affecte la vaeur None a l'option weights, pour activer le positionnement automatique des candidats aux noeuds @@ -1093,24 +1110,24 @@ # on construit un seul nouveau contacteur avec tous les elements du groupe # N.B.: la copie profonde de la liste d'element est effectuee par chaque contructeur de contacteur maille, # il est donc inutile de le faire ici - contact=contactorFactory(type=type, elements=list_ele, color=color, **options) + contact=contactorFactory(shape=shape, elements=list_ele, color=color, **options) # une fois le contacteur entierement defini, on l'ajoute au container de contacteurs de l'avatar self._addContactor(contact) # et au container de contacteurs portes par le groupe self.groups[group].addContactor(contact)
-
[docs] def imposeDrivenDof(self,group='all',component=1, type='predefined',ct=0.,amp=0.,omega=0., +
[docs] def imposeDrivenDof(self,group='all',component=1, description='predefined',ct=0.,amp=0.,omega=0., phi=0.,rampi=1.,ramp=0.,evolutionFile='', dofty='temp'): - """imposeDrivenDof(self,group='all',component=1,type='predefined',ct=0.,amp=0.,omega=0., + """imposeDrivenDof(self,group='all',component=1,description='predefined',ct=0.,amp=0.,omega=0., phi=0.,rampi=1.,ramp=0.,evolutionFile='',dofty='temp') - this function associate a boundary conditiojn to each node of the considered group of the + this function associate a boundary condition to each node of the considered group of the considered avatar parameters: - dofty : type of boundary condition (vlocy for velocity, force for.. force, temp for temperature and flux for heat flux) - - type : 'predefined' or 'evolution' + - description : 'predefined' or 'evolution' * 'predefined': ct, amp, omega, phi, rampi and ramp must be defined so that the boundary value will be : [ ct + amp * cos(omega*t+phi) ] * sgn(rampi + ramp*t) * min(abs(rampi + ramp*t), 1), @@ -1166,7 +1183,7 @@ showError(msg) # si la C.L. imposee est de type 'predefined' - if type == 'predefined': + if description == 'predefined': # on identife les parties de la fonction identiquement nulles ct_is_zero = (ct == 0.) cos_is_zero = (amp == 0. or (omega == 0. and phi == 0.)) @@ -1225,10 +1242,10 @@ if no.dof == None: showError("no dof defined. It's defined when you define a model.") - no.imposeDrivenDof(component,type, ct,amp,omega,phi,rampi, + no.imposeDrivenDof(component,description, ct,amp,omega,phi,rampi, ramp,evolutionFile,dofty)
-
[docs] def relaxDrivenDof(self, group='all', component=1): +
[docs] def relaxDrivenDof(self, group='all', component=1): """relaxDrivenDof(self, group='all', component=1): this function relax driven dof @@ -1279,7 +1296,7 @@ # on relaxe la condition limite porte par le ddl du noeud, suivant la composante donnee no.relaxDrivenDof(component)
-
[docs] def imposeInitValue(self,group='all',component=1,value=0.): +
[docs] def imposeInitValue(self,group='all',component=1,value=0.): """imposeInitValue(self,group='all',component=1,value=0.) impose a value to a degree of freedom @@ -1341,7 +1358,7 @@ # fonction qui construit un nouveau groupe comme le sous-groupe # d'un groupe existant -
[docs] def addGroupUsingPredicate(self, name, predicate, super_group='all'): +
[docs] def addGroupUsingPredicate(self, name, predicate, super_group='all'): """adddGroupUsingPredicate(self, name, predicate, super_group='all'): this function builds and add a new group to the avatar, by @@ -1442,7 +1459,7 @@ # fonction qui renvoie la liste des noeuds d'un groupe physique # existant -
[docs] def getNodebyGroup(self, group): +
[docs] def getNodebyGroup(self, group): """getNodebyGroup(self,group): this functions return the node list by physical group to this avatar """ @@ -1457,7 +1474,7 @@ return numpy.array(listnode)
# construction d'un avatar a partir d'un maillage -
[docs]def buildMeshedAvatar(mesh, model, material): +
[docs]def buildMeshedAvatar(mesh, model, material): """buildMeshedAvatar(mesh, model, material): this function builds a meshed avatar from the mesh. @@ -1472,7 +1489,7 @@ showError("The given mesh is not a mesh!") # on cree un avatar maille - body = avatar(type='MAILx', dimension=mesh.dimension) + body = avatar(dimension=mesh.dimension) # on renumerote les noeuds du maillage en utilisant leur rang mesh.rankRenumbering() # on ajoute les noeuds du maillage a l'avatar maille @@ -1499,8 +1516,8 @@ \ No newline at end of file diff --git a/docs/Pre/_modules/pylmgc90/pre_lmgc/avatar/bulk/bulk.html b/docs/Pre/_modules/pylmgc90/pre/avatar/bulk/bulk.html similarity index 82% rename from docs/Pre/_modules/pylmgc90/pre_lmgc/avatar/bulk/bulk.html rename to docs/Pre/_modules/pylmgc90/pre/avatar/bulk/bulk.html index 7bf222ada5faba19aa10cab687af22b91ce3e89a..fe2ee0ef9cb1e60b649f4a228f77fa050ef60229 100644 --- a/docs/Pre/_modules/pylmgc90/pre_lmgc/avatar/bulk/bulk.html +++ b/docs/Pre/_modules/pylmgc90/pre/avatar/bulk/bulk.html @@ -6,7 +6,7 @@ - pylmgc90.pre_lmgc.avatar.bulk.bulk — pylmgc90.pre 2015.2 documentation + pylmgc90.pre.avatar.bulk.bulk — pylmgc90.pre 2015.2 documentation @@ -46,35 +46,35 @@
-

Source code for pylmgc90.pre_lmgc.avatar.bulk.bulk

+  

Source code for pylmgc90.pre.avatar.bulk.bulk

 import sys
 
-from pylmgc90.pre_lmgc.shared.bulk_behav import *
-from pylmgc90.pre_lmgc.shared.model import *
+from pylmgc90.pre.shared.bulk_behav import *
+from pylmgc90.pre.shared.model import *
 import numpy
 
-from pylmgc90.pre_lmgc.config.lmgc90dicts import *
+from pylmgc90.pre.config.lmgc90dicts import *
 
-from pylmgc90.pre_lmgc.utilities.error    import *
+from pylmgc90.pre.utilities.error    import *
 
 
 ## @class bulk
 #
 # description 
-
[docs]class bulk: +
[docs]class bulk(): - def __init__(self, type, connectivity, physicalEntity='1', geometricalEntity='1', number=None, nbNodes=None): - """ __init__(self, type, connectivity, physicalEntity='1', geometricalEntity='1', number=None, nbNodes=None) + def __init__(self, elem_dim, connectivity, physicalEntity='1', geometricalEntity='1', number=None, nbNodes=None): + """ __init__(self, elem_dim, connectivity, physicalEntity='1', geometricalEntity='1', number=None, nbNodes=None) this function initializes a new bulk - N.B.: a bulk is always a finite element; a rigid body have a single finite element, which geomtrical support + N.B.: a bulk is always a finite element; a rigid body have a single finite element, which geometrical support is a point parameters: - self: the bulk itself - - type: element type + - elem_dim: dimension of the element (volumic=3, surfacic=2, lineic=1, point=0) - connectivity: connectivity of the element optional parameters: @@ -105,21 +105,17 @@ showWarning("assign a number of nodes to an element is useless since its can be computed from the connectivity!") # on calcule le nombre de noeuds a partir de la connecivite - nbNodes = len(connectivity) + nbNodes = len(connectivity) - # si le type d'element geometrique n'a pas ete reconnu - if not type in listeGeo: - # on affiche un message d'erreur - showError("unknown geometrical element : " + type + "!") + if elem_dim not in geoAndnbNodes2Element.keys(): + showError("unknown geometrical element dimension: " + str(elem_dim) + "!") - # si le nombre de noeuds de l'element est incompatible avec son type - if nbNodes != geo2nbNodes[type]: - # on affiche un message d'erreur - showError("the given number of nodes (" + str(nbNodes) + ") is incompatible with an element " + type) + if nbNodes not in geoAndnbNodes2Element[elem_dim].keys(): + showError("the given number of nodes (" + str(nbNodes) + ") is incompatible with element geometric dimension" + str(elem_dim)) # ici, on est sur que le type d'element et la connectivite donnes sont valides - self.type = type + self.etype = geoAndnbNodes2Element[elem_dim][nbNodes] self.nbNodes = nbNodes self.connectivity = connectivity @@ -134,7 +130,7 @@ ## @brief define material of the bulk # -
[docs] def defineMaterial(self,mat): +
[docs] def defineMaterial(self,mat): """defineMaterial(mat) 'mat' is either a string or a of the class 'material' @@ -153,11 +149,11 @@ # on teste la coherence entre le modele et le materiau en fonction # du type de modele - if self.model.type == 'MECAx': # cas du modele mecanique + if self.model.physics == 'MECAx': # cas du modele mecanique # * cas du modele rigide if self.model.element in rigidElements: # on verifie que que le materiau definisse une masse volumique - if not 'density' in bulkBehavOptions[mat.type]: + if not 'density' in bulkBehavOptions[mat.materialType]: # si ce n'est pas le cas on indique la liste des materiaux compatibles msg = "Type de materiau incompatible avec un modele rigide, en mecanique\n" + \ "les materiaux utilisables avec ce modele sont:\n" @@ -168,7 +164,7 @@ # * cas du modele discret elif self.model.element in discreteElements: # on verifie que le materiau soit du bon type - if mat.type != 'DISCRETE': + if mat.materialType != 'DISCRETE': showError("the only material available for a discrete element model for a meshed avatar is DISCRETE!") # on verifie que le materiau soit compatible avec la dimension if numpy.size(mat.masses) != self.model.dimension: @@ -176,17 +172,17 @@ # * cas d'un modele associe a un element fini non gere par LMGC90 elif self.model.element.startswith('EXT'): # on verifie que le materiau soit du bon type - if mat.type != 'EXTERNAL': + if mat.materialType != 'EXTERNAL': showError("the only material available for a an external finite element is EXTERNAL!") # * cas du modele utilisateur (associe a un fichier MatLib) elif hasattr(self.model, 'user_model_name'): # on verifie que le materiau soit du bon type - if mat.type != 'USER_MAT': + if mat.materialType != 'USER_MAT': showError("Un materiau utilisateur (type \"USER_MAT\") doit etre associe a un modele utilisateur (i.e. option \"user_model_name\" definie)!\n") # * cas d'un modele gere par LMGC90 (interne a LMGC90 ou un modele de MatLib deja cable) elif hasattr(self.model, 'material'): # on verifie que le materiau est compatible avec le modele - if not mat.type in mecaModel2bulkBehavs[self.model.material]: + if not mat.materialType in mecaModel2bulkBehavs[self.model.material]: # si ce n'est pas le cas, on inidque a l'utilisateur la liste des modeles compatibles msg = "Type de materiau incompatible avec un modele \"material=\"" + self.model.material + "\", " + \ "les materiaux utilisables avec ce modele sont:\n" @@ -203,7 +199,7 @@ else: showError("Model associated to the current bulk is unhandled!") - if self.model.type == 'THERx': # cas du modele thermique + if self.model.physics == 'THERx': # cas du modele thermique # * cas du modele rigide if self.model.element in rigidElements: # on leve une exception pour indiquer que ce n'est pas encore @@ -212,7 +208,7 @@ # * cas general (element fini avec thermique claculee en uitilisant le modele interne de LMGC90) else: # si le modele n'est pas adapte - if mat.type != 'THERMO_ELAS': + if mat.materialType != 'THERMO_ELAS': # on affiche une message d'erreur showError("the only material available for a thermic model for a meshed avatar is THERMO_ELAS!") @@ -221,7 +217,7 @@ ## @brief define models of the bulk # -
[docs] def defineModel(self,mod): +
[docs] def defineModel(self,mod): """defineModel(mod) 'mod' is a model @@ -230,7 +226,7 @@ if isinstance(mod, model): # si l'element porte par le modele repose sur l'element # geometrique porte par l'element - if mod.element in geo2element[self.type]: + if mod.element in geo2element[self.etype]: # on associe le modele a l'element self.model = mod # sinon, si le modele est un modele caracterisant un element dini externe, non gere par LMGC90 @@ -247,7 +243,7 @@ showError('[bulk.defineModel] Could not add the model to the bulk')
def __str__(self): - impr = "%5s\tnumber :\t%10s\n" % (self.type,self.number) + impr = "%5s\tnumber :\t%10s\n" % (self.etype,self.number) return impr
@@ -260,8 +256,8 @@ \ No newline at end of file diff --git a/docs/Pre/_modules/pylmgc90/pre_lmgc/avatar/bulks.html b/docs/Pre/_modules/pylmgc90/pre/avatar/bulks.html similarity index 86% rename from docs/Pre/_modules/pylmgc90/pre_lmgc/avatar/bulks.html rename to docs/Pre/_modules/pylmgc90/pre/avatar/bulks.html index 52888abfbf3781af7cb3ffb1d42315b22b42277f..46a0fd4aaba69a7a4b93df5e7f274ee9929b0bc9 100644 --- a/docs/Pre/_modules/pylmgc90/pre_lmgc/avatar/bulks.html +++ b/docs/Pre/_modules/pylmgc90/pre/avatar/bulks.html @@ -6,7 +6,7 @@ - pylmgc90.pre_lmgc.avatar.bulks — pylmgc90.pre 2015.2 documentation + pylmgc90.pre.avatar.bulks — pylmgc90.pre 2015.2 documentation @@ -46,22 +46,22 @@
-

Source code for pylmgc90.pre_lmgc.avatar.bulks

-from pylmgc90.pre_lmgc.utilities.container import *
+  

Source code for pylmgc90.pre.avatar.bulks

+from pylmgc90.pre.utilities.container import *
 
 from bulk.bulk import *
 from groups import *
 
 ## @class bulks(sequence_container)
 # bulk iterator
-
[docs]class bulks(sequence_container): +
[docs]class bulks(sequence_container): """ bulk container inherits from container class 'sequence_container' i.e. keys are automatically attributed """ -
[docs] def addBulk(self,new): +
[docs] def addBulk(self,new): """addBulk(self,new) add a bulk to the container and index it with its number """ @@ -86,8 +86,8 @@ \ No newline at end of file diff --git a/docs/Pre/_modules/pylmgc90/pre_lmgc/avatar/contactor/contactor.html b/docs/Pre/_modules/pylmgc90/pre/avatar/contactor/contactor.html similarity index 87% rename from docs/Pre/_modules/pylmgc90/pre_lmgc/avatar/contactor/contactor.html rename to docs/Pre/_modules/pylmgc90/pre/avatar/contactor/contactor.html index de23f512229f3fe3c6140ed9de500b52073d6ac7..dcaf4d679c423b23292e468796563d4928404577 100644 --- a/docs/Pre/_modules/pylmgc90/pre_lmgc/avatar/contactor/contactor.html +++ b/docs/Pre/_modules/pylmgc90/pre/avatar/contactor/contactor.html @@ -6,7 +6,7 @@ - pylmgc90.pre_lmgc.avatar.contactor.contactor — pylmgc90.pre 2015.2 documentation + pylmgc90.pre.avatar.contactor.contactor — pylmgc90.pre 2015.2 documentation @@ -46,24 +46,24 @@
-

Source code for pylmgc90.pre_lmgc.avatar.contactor.contactor

+  

Source code for pylmgc90.pre.avatar.contactor.contactor

 import numpy
 import copy
 
-from pylmgc90.pre_lmgc.config.lmgc90dicts import *
+from pylmgc90.pre.config.lmgc90dicts import *
 
-from pylmgc90.pre_lmgc.avatar.bulks import *
-from pylmgc90.pre_lmgc.avatar.bulk.bulk import *
+from pylmgc90.pre.avatar.bulks import *
+from pylmgc90.pre.avatar.bulk.bulk import *
 
 ## @class contactor
 #
-
[docs]class contactor: - """ class contactor +
[docs]class contactor(): + """ class contactor() attributs: - number : an identifier - - type : lmgc90 tact type (char[5]) + - shape : lmgc90 tact type (char[5]) - elements: a bulk list - color : lmgc90 color for tact_behav (char[5]) - connectivity: nodes' indices defining the contactor @@ -77,8 +77,8 @@ ## @brief default constructor # - def __init__(self, elements, type, color, number=None): - """__init__(self, elements, type, color, number=None) + def __init__(self, elements, shape, color, number=None): + """__init__(self, elements, shape, color, number=None) allow to define a contactor @@ -87,7 +87,7 @@ - self: the contactor itself - elements: a list of connex elements, which is the base of the contactor WARNING: elements must be of the same type! - - type: type of the contactor + - shape: type of the contactor - color: color of the contactor optional parameters: @@ -111,7 +111,7 @@ msg='all elements of the given elements list keyword must be element objects!' showError(msg) # on conserve le type de l'element - element_type=first_element.type + element_type=first_element.etype # pour chaque autre element de la liste for i in xrange(1, len(elements)): @@ -122,7 +122,7 @@ msg='all elements of the given elements list keyword must be element objects!' showError(msg) # si l'element n'est pas du bon type - if ele.type != element_type: + if ele.etype != element_type: # on affiche un message d'erreur msg='all elements of the given elements list must have the same type!' showError(msg) @@ -130,9 +130,9 @@ # ici, on est sur que la liste elements ne contient que des elements du meme type # si le type de contacteur n'est compatible avec le type d'element - if not type in geo2contactor[element_type]: + if not shape in geo2contactor[element_type]: # on construit un message d'erreur - msg='Incompatible element (%s) and contactor type (%s)\n' %(element_type, type) + msg='Incompatible element (%s) and contactor type (%s)\n' %(element_type, shape) if number != None: msg+='for contactor :%s' % str(number) # on l'affiche @@ -170,11 +170,11 @@ # @param attribut : name of the attribut to get the value # @return : value of attribut # @todo : to put in contactor class ? -
[docs] def getOption(self,attribut): +
[docs] def getOption(self,attribut): """ getOption(self,attribut) """ value=0. - if attribut in contactorOptions[self.type]: + if attribut in contactorOptions[self.shape]: value=getattr(self, attribut) return value
@@ -183,17 +183,17 @@ # @todo : to put in contactor class ? def writeOpt(self): ligne='' - for opt in contactorOptions[self.type]: + for opt in contactorOptions[self.shape]: ligne+=' %5s=%14.7E' % (opt, getattr(self, opt)) return ligne def __str__(self): """method allowing to print informations concerning the contactor """ - impr='Contactor number :\t%5s \t of type :\t%5s' % (self.number,self.type) + impr='Contactor number :\t%5s \t of type :\t%5s' % (self.number,self.shape) return impr -
[docs] def strInBodiesFile(self, number): +
[docs] def strInBodiesFile(self, number): """strInBodiesFile(self, number): this function returns a string used to represent the contactor in the BODIES.DAT file. @@ -210,7 +210,7 @@ ## @brief get the contactor in anonymous shape # Get the contactor in the form of 3 vectors of different type (char[5], int and double) -
[docs] def get_anonymous_shape(self): +
[docs] def get_anonymous_shape(self): """get_anonympous_shape(self, number): this function returns the contactor type (type), the contactor color (color), @@ -221,7 +221,7 @@ - self: the contactor itself - returned value: the tuple (type, color, i4_vector, r8_vector). + returned value: the tuple (shape, color, i4_vector, r8_vector). """ # N.B.: il s'agit d'une fonction virtuelle pure, qui n'a donc pas d'implementation generique. raise NotImplementedError
@@ -235,8 +235,8 @@ \ No newline at end of file diff --git a/docs/Pre/_modules/pylmgc90/pre_lmgc/avatar/contactors.html b/docs/Pre/_modules/pylmgc90/pre/avatar/contactors.html similarity index 83% rename from docs/Pre/_modules/pylmgc90/pre_lmgc/avatar/contactors.html rename to docs/Pre/_modules/pylmgc90/pre/avatar/contactors.html index 95982127388f3f9bbf24ddb710b3061f1ead3c03..09b65b11f867d1fbfbec3313a59aa9c546a742f2 100644 --- a/docs/Pre/_modules/pylmgc90/pre_lmgc/avatar/contactors.html +++ b/docs/Pre/_modules/pylmgc90/pre/avatar/contactors.html @@ -6,7 +6,7 @@ - pylmgc90.pre_lmgc.avatar.contactors — pylmgc90.pre 2015.2 documentation + pylmgc90.pre.avatar.contactors — pylmgc90.pre 2015.2 documentation @@ -46,21 +46,21 @@
-

Source code for pylmgc90.pre_lmgc.avatar.contactors

-from pylmgc90.pre_lmgc.utilities.container import *
+  

Source code for pylmgc90.pre.avatar.contactors

+from pylmgc90.pre.utilities.container import *
 
 from contactor.contactor import *
 
 ## @class contactors(sequence_container)
 # contactor iterator
-
[docs]class contactors(sequence_container): +
[docs]class contactors(sequence_container): """ contactor container inherits from container class 'sequence container' i.e. keys are automatically attributed """ -
[docs] def addContactor(self,tact): +
[docs] def addContactor(self,tact): """addcontactor(self,tact) assign a number to a contactor and add it to the container @@ -75,7 +75,7 @@ return self
-
[docs] def lastContactor(self): +
[docs] def lastContactor(self): """lastContactor(self) returns last contactor number of the list @@ -91,8 +91,8 @@ \ No newline at end of file diff --git a/docs/Pre/_modules/pylmgc90/pre_lmgc/avatar/node/node.html b/docs/Pre/_modules/pylmgc90/pre/avatar/node/node.html similarity index 83% rename from docs/Pre/_modules/pylmgc90/pre_lmgc/avatar/node/node.html rename to docs/Pre/_modules/pylmgc90/pre/avatar/node/node.html index 49fc1b05387d9963c90fde185ca88251b26019b4..efca067dc8f25746a2602e3655f154bdc3ee5c6f 100644 --- a/docs/Pre/_modules/pylmgc90/pre_lmgc/avatar/node/node.html +++ b/docs/Pre/_modules/pylmgc90/pre/avatar/node/node.html @@ -6,7 +6,7 @@ - pylmgc90.pre_lmgc.avatar.node.node — pylmgc90.pre 2015.2 documentation + pylmgc90.pre.avatar.node.node — pylmgc90.pre 2015.2 documentation @@ -46,22 +46,22 @@
-

Source code for pylmgc90.pre_lmgc.avatar.node.node

+  

Source code for pylmgc90.pre.avatar.node.node

 ## module node
 # define node class
 
 import numpy
 
-from pylmgc90.pre_lmgc.config.lmgc90dicts      import *
+from pylmgc90.pre.config.lmgc90dicts      import *
 
 import sys
 import numpy
 
-from pylmgc90.pre_lmgc.models             import *
-from pylmgc90.pre_lmgc.shared.model       import *
+from pylmgc90.pre.models             import *
+from pylmgc90.pre.shared.model       import *
 from dof import *
 
-from pylmgc90.pre_lmgc.utilities.error    import *
+from pylmgc90.pre.utilities.error    import *
 
 
 
@@ -70,36 +70,37 @@
 #  \n
 # attributs: \n
 # number its number (as an integer)\n
-# type type of the node (NO2xx...)\n
 # coor coordinates \n
 # dofs degrees of freedom \n 
 # \n
 # methods: \n
 #  __init__ constructor \n
 #  getCoor: gets back coor \n
-#  defineDof: defines the dofs associated to the node (depend on the models) \n
+#  defineDof: defines the dofs associated to the node (depends on the model) \n
 #  imposeDrivenDof: imposes degrees of freedom\n
 #  relaxDrivenDof: frees a dof previously imposed\n
 #  translate: translate the node\n
-
[docs]class node: +
[docs]class node(): """ Class defining the node entity """ ## node constructor # - def __init__(self,type=None,coor=None,number=0): - """ __init__(self,type=None,coor=None,number=0): + def __init__(self,coor=None,number=0): + """ __init__(self,coor=None,number=0): - initialize a node entity + initialize a node entity. + coor an array defining the corrdinates """ - self.type = type self.number = number if coor is None: self.coor = [] else : self.coor = coor - self.dof = None + self.ntype = dimensionTypeNode[coor.shape[0]] + + self.dof = None # necessaire pour garder le lien avec le maillage de depart if number != 0: @@ -109,11 +110,11 @@ if not self.checkType(): msg = 'instanciating node: uncompatible type/dimension ' - msg += type + '\t' + str(self.coor.size) + msg += self.ntype + '\t' + str(self.coor.size) showError(msg) ## coordinates -
[docs] def getCoor(self): +
[docs] def getCoor(self): """ getCoor(self) returns coor @@ -135,11 +136,11 @@ sys.exit(1) ## impose dofs - def imposeDrivenDof(self,composantes,type='predefined',ct=0.,amp=0.,omega=0., + def imposeDrivenDof(self,composantes,description='predefined',ct=0.,amp=0.,omega=0., phi=0.,rampi=0.,ramp=0.,evolutionFile='unknown',dofty='unknown'): if self.dof != None: - self.dof.imposeDrivenDof(composantes,type,ct,amp,omega,phi,rampi,ramp,evolutionFile,dofty) + self.dof.imposeDrivenDof(composantes,description,ct,amp,omega,phi,rampi,ramp,evolutionFile,dofty) else: msg='Cannot impose dof on node %s' % self.number showWarning(msg) @@ -158,19 +159,19 @@ ## \brief return a node with anonynous shape def get_anonymous_shape(self): - type = self.type + ntype = self.ntype r8_vect = self.coor - return [type, r8_vect] + return [ntype, r8_vect] ## \brief check type and size consistency def checkType(self): res = True dim = -1 for key in dimensionTypeNode: - if self.type in dimensionTypeNode[key]: + if self.ntype in dimensionTypeNode[key]: dim = key if dim == -1: - msg = '[checkType] unknown node type ' + self.type + msg = '[checkType] unknown node type ' + self.ntype showError(msg) if dim != self.coor.size : res = False @@ -190,8 +191,13 @@ msg = '[translate]: do not know how to apply translation to a node with ' + numpy.size(self.coor) + 'coordinates' showWarning(msg) + ## @brief scale the node + # The coordinates to change depends on type + def scale(self, scale): + self.coor *= scale + ## @brief apply an affine map to the node coordinates -
[docs] def applyAffineMapToCoor(self, q, center): +
[docs] def applyAffineMapToCoor(self, q, center): """applyAffineMapToCoor(self, q, center): this function applies an affine map to the node coordinates. @@ -227,8 +233,8 @@ \ No newline at end of file diff --git a/docs/Pre/_modules/pylmgc90/pre_lmgc/avatar/nodes.html b/docs/Pre/_modules/pylmgc90/pre/avatar/nodes.html similarity index 85% rename from docs/Pre/_modules/pylmgc90/pre_lmgc/avatar/nodes.html rename to docs/Pre/_modules/pylmgc90/pre/avatar/nodes.html index 1f36a68d42c757ecc90b4410759787ee484ba01a..853d4d7484112e810db8867b6a7be229affb07fa 100644 --- a/docs/Pre/_modules/pylmgc90/pre_lmgc/avatar/nodes.html +++ b/docs/Pre/_modules/pylmgc90/pre/avatar/nodes.html @@ -6,7 +6,7 @@ - pylmgc90.pre_lmgc.avatar.nodes — pylmgc90.pre 2015.2 documentation + pylmgc90.pre.avatar.nodes — pylmgc90.pre 2015.2 documentation @@ -46,21 +46,21 @@
-

Source code for pylmgc90.pre_lmgc.avatar.nodes

-from pylmgc90.pre_lmgc.utilities.container import *
+  

Source code for pylmgc90.pre.avatar.nodes

+from pylmgc90.pre.utilities.container import *
 
 from node.node import *
 
 ## @class nodes(mapping_container)
 #  node iterator
-
[docs]class nodes(mapping_container): +
[docs]class nodes(mapping_container): """ node container inherits from container class 'iterator' key is the number of the node """ -
[docs] def addNode(self,noeud): +
[docs] def addNode(self,noeud): """addNode(self,noeud) add a node to the container and index it with its number @@ -83,8 +83,8 @@ \ No newline at end of file diff --git a/docs/Pre/_modules/pylmgc90/pre_lmgc/avatars.html b/docs/Pre/_modules/pylmgc90/pre/avatars.html similarity index 70% rename from docs/Pre/_modules/pylmgc90/pre_lmgc/avatars.html rename to docs/Pre/_modules/pylmgc90/pre/avatars.html index 0f487c580d0f2aacd52a0036b308eff766724f96..aa8e5ac620a1d75ee138e014e744d089fd2bea49 100644 --- a/docs/Pre/_modules/pylmgc90/pre_lmgc/avatars.html +++ b/docs/Pre/_modules/pylmgc90/pre/avatars.html @@ -6,7 +6,7 @@ - pylmgc90.pre_lmgc.avatars — pylmgc90.pre 2015.2 documentation + pylmgc90.pre.avatars — pylmgc90.pre 2015.2 documentation @@ -46,14 +46,14 @@
-

Source code for pylmgc90.pre_lmgc.avatars

+  

Source code for pylmgc90.pre.avatars

 import numpy
 from utilities.container import *
 
 from avatar.avatar import *
 
 ## @class avatars : avatar list
-
[docs]class avatars(sequence_container): +
[docs]class avatars(sequence_container): """ avatar container class Methods: @@ -79,24 +79,26 @@ # showWarning(msg) ## add an avatar to container -
[docs] def addAvatar(self, avatar): - '''addAvatar(self,avatar): +
[docs] def addAvatar(self, av): + '''addAvatar(self,av): this function adds the input avatar to the container parameters: - self: the container itself - - avatar: a given avatar + - av: a given avatar ''' + assert isinstance(av,avatar), "%r is not an avatar"%av + # on atribue a l'avatar le prochain numero disponible # N.B.: si l'avatar provient d'un autre container, son # son numero est ecrase, et renvoie au dernier # container ou il a ete ajoute - avatar.number = len(self) + av.number = len(self) # on ajoute l'avatar dans le container - self.append(avatar)
+ self.append(av)
## add one avatar, or a list of avatars, to the container def __iadd__(self,object): @@ -130,7 +132,7 @@ # on renvoie le conteneur modifie return self -
[docs] def getFemAvatar(self): +
[docs] def getFemAvatar(self): """ getFemAvatar(self) get the list of avatar of MAILx type @@ -138,13 +140,13 @@ listeMesh=[] for j in self.keys(): - if self[j].type == 'MAILx': + if self[j].atype == 'MAILx': listeMesh.append(j) return listeMesh
## -
[docs] def getRigidAvatar(self): +
[docs] def getRigidAvatar(self): """getRigidAvatar(self) get the list of avatar of RBDY2 or RBDY3 type @@ -152,13 +154,13 @@ listeRigid = [] for j in self.keys(): - if self[j].type == 'RBDY2' or self[j].type == 'RBDY3': + if self[j].atype == 'RBDY2' or self[j].atype == 'RBDY3': listeRigid.append(j) return listeRigid
## translate a set of avatars # @param dx,dy, dz tranlation vector -
[docs] def translate(self, dx=0., dy=0., dz=0.): +
[docs] def translate(self, dx=0., dy=0., dz=0.): """ usage self.tranlsate(dx=0., dy=0., dz=0.) where dx, dy, dz are components of translation vector @@ -168,8 +170,8 @@ avatar.translate(dx=dx,dy=dy,dz=dz)
## translate a set of avatars -
[docs] def rotate(self, type='Euler', phi=0., theta=0., psi=0., alpha=0., axis=[0., 0., 1.], center=[0., 0., 0.]): - """rotate(self, type='Euler', phi=0., theta=0., psi=0., alpha=0., axis=[0., 0., 1.], center=[0., 0., 0.]) +
[docs] def rotate(self, description='Euler', phi=0., theta=0., psi=0., alpha=0., axis=[0., 0., 1.], center=[0., 0., 0.]): + """rotate(self, description='Euler', phi=0., theta=0., psi=0., alpha=0., axis=[0., 0., 1.], center=[0., 0., 0.]) this function rotates every avatar in the set, according to the given rotation parameters and a rotation center. Supported rotation paramters are: Euler's angles or an axis and an angle @@ -177,11 +179,11 @@ parameters: - self: the avatar itself - - type='Euler': type defines the rotation parameters: + - description='Euler': defines the rotation parameters: - - if type = 'Euler', the rotation uses Euler's angles, consequently only phi, theta, psi and + - if description = 'Euler', the rotation uses Euler's angles, consequently only phi, theta, psi and center are considered - - if type = 'axis', the rotation uses an axis and an angle, consequently only axis, alpha and + - if description = 'axis', the rotation uses an axis and an angle, consequently only axis, alpha and center are considered - phi: first Euler's angle (rotation with respect to z-axis) @@ -194,7 +196,7 @@ # on applique la rotation a chaque avatar du conteneur for avatar in self: - avatar.rotate(type=type, phi=phi, theta=theta, psi=psi, alpha=alpha, axis=axis, center=center)
+ avatar.rotate(description=description, phi=phi, theta=theta, psi=psi, alpha=alpha, axis=axis, center=center)
@@ -205,8 +207,8 @@ \ No newline at end of file diff --git a/docs/Pre/_modules/pylmgc90/pre_lmgc/build_avatar/brick.html b/docs/Pre/_modules/pylmgc90/pre/build_avatar/brick.html similarity index 89% rename from docs/Pre/_modules/pylmgc90/pre_lmgc/build_avatar/brick.html rename to docs/Pre/_modules/pylmgc90/pre/build_avatar/brick.html index 9bc0cd4510cd9b0adf8b1d4a72f51d1ac036f943..ced1c4b225116b95b69be2d0d9d81b30a873e593 100644 --- a/docs/Pre/_modules/pylmgc90/pre_lmgc/build_avatar/brick.html +++ b/docs/Pre/_modules/pylmgc90/pre/build_avatar/brick.html @@ -6,7 +6,7 @@ - pylmgc90.pre_lmgc.build_avatar.brick — pylmgc90.pre 2015.2 documentation + pylmgc90.pre.build_avatar.brick — pylmgc90.pre 2015.2 documentation @@ -46,20 +46,20 @@
-

Source code for pylmgc90.pre_lmgc.build_avatar.brick

+  

Source code for pylmgc90.pre.build_avatar.brick

 # module qui fournit une classe brique 2D, ou 3D
 
 import numpy
 import math
 
-from pylmgc90.pre_lmgc.avatar.bulk.rigid2d import *
-from pylmgc90.pre_lmgc.avatar.bulk.element import *
+from pylmgc90.pre.avatar.bulk.rigid2d import *
+from pylmgc90.pre.avatar.bulk.element import *
 
 # macros pour generer des maillages de rectangles (2D)
 from mesh2D import *
 
 # classe brique 2D
-
[docs]class brick2D: +
[docs]class brick2D(): '''class designed to build rigid or deformable bricks in 2D Methods: @@ -90,7 +90,7 @@ self.ly=ly # hauteur # creation d'une brique rigide -
[docs] def rigidBrick(self, center, model, material, color='BLEUx', number=None): +
[docs] def rigidBrick(self, center, model, material, color='BLEUx', number=None): '''rigidBrick(self, center, model, material, color='BLEUx', number=None): this function build and returns a rigid brick @@ -108,13 +108,11 @@ - number=None: index of the avatar (still present to ensure compatibility)''' # creation d'une nouvelle brique rigide - body = avatar(type='RBDY2', dimension=2, number=number) + body = avatar(dimension=2, number=number) # on lui attribue un comportement volumique de type rigide body.addBulk( rigid2d() ) # ajout de la position du centre d'inertie de la brique - body.addNode( - node(type='NO2xx',coor=numpy.array(center), - number=1) ) + body.addNode( node(coor=numpy.array(center), number=1) ) # on definit les groupes pour la brique body.defineGroups() # on affecte son modele rigide a la brique @@ -139,7 +137,7 @@ vertices[3, 0] = -0.5*self.lx vertices[3, 1] = 0.5*self.ly # on peut alors ajouter son contacteur polygone a la brique - body.addContactors(type='POLYG',color=color, nb_vertices=4, + body.addContactors(shape='POLYG',color=color, nb_vertices=4, vertices=vertices) # on calcule la surface et l'inertie de la brique body.computeRigidProperties() @@ -148,10 +146,10 @@ return body
# creation d'une brique deformable -
[docs] def deformableBrick(self, center, material, model, type='4T3', +
[docs] def deformableBrick(self, center, material, model, mesh_type='4T3', nb_elem_x=1, nb_elem_y=1, apabh=None, apabv=None, apabhc=0.25, apabvc=0.25, colors=['HORIx', 'VERTx', 'HORIx', 'VERTx'], number=None): - '''deformableBrick(self, center, material, model, number, type='4T3', + '''deformableBrick(self, center, material, model, number, mesh_type='4T3', nb_elem_x=1, nb_elem_y=1, apabh=None, apabv=None, apabhc=0.25, apabvc=0.25, colors=['HORIx', 'VERTx', 'HORIx', 'VERTx']): @@ -166,7 +164,7 @@ optional parameters : - - type='4T3': meshing strategy for the brick + - mesh_type='4T3': meshing strategy for the brick (possible values: 'Q4', 'Q8', '2T3' and '4T3') - nb_elem_x: number of elements Q4 following direction Ox - nb_elem_y: number of elements Q4 following direction Oy @@ -185,25 +183,25 @@ x0=center[0] - 0.5*self.lx y0=center[1] - 0.5*self.ly # on genere le maillage de la brique - mesh_brick=buildMesh2D(type, x0, y0, self.lx, self.ly, nb_elem_x, nb_elem_y) + mesh_brick=buildMesh2D(mesh_type, x0, y0, self.lx, self.ly, nb_elem_x, nb_elem_y) # on contruit un corps maille a partir du maillage de la brique body=buildMeshedAvatar(mesh=mesh_brick, model=model, material=material) # on ajoute les contacteurs : # * une ligne antagoniste sur le dessus du bloc - body.addContactors(group='up',type='ALpxx',color=colors[2]) + body.addContactors(group='up',shape='ALpxx',color=colors[2]) # * les points candidats sur le dessous du bloc # si on donne des positions pour le points de contacts, on les # utilise if ( apabh ): # fd pas comprendre - #body.addContactors(group='down',type='CLxxx',color=colors[0], + #body.addContactors(group='down',shape='CLxxx',color=colors[0], # connex='no', weights=apabh) - body.addContactors(group='down',type='CLxxx',color=colors[0], + body.addContactors(group='down',shape='CLxxx',color=colors[0], weights=apabh) # sinon, else: # on les place aux sommets du maillage - body.addContactors(group='down',type='CLxxx',color=colors[0]) + body.addContactors(group='down',shape='CLxxx',color=colors[0]) # on deplace les noeuds situes : # * dans le coin inferieur gauche de la brique _moveContactorCLxxx(coor=[x0, y0], body=body, color=colors[0], apab=apabhc) @@ -211,19 +209,19 @@ _moveContactorCLxxx(coor=[x0 + self.lx, y0], body=body, color=colors[0], apab=apabhc) # * une ligne antagoniste sur le cote gauche du bloc - body.addContactors(group='left',type='ALpxx',color=colors[3]) + body.addContactors(group='left',shape='ALpxx',color=colors[3]) # * les points candidats sur le cote droit du bloc # si on donne des positions pour le points de contacts, on les # utilise if ( apabv ): - #body.addContactors(group='right',type='CLxxx',color=colors[1], + #body.addContactors(group='right',shape='CLxxx',color=colors[1], # connex='no', weights=apabv) - body.addContactors(group='right',type='CLxxx',color=colors[1], + body.addContactors(group='right',shape='CLxxx',color=colors[1], weights=apabv) # sinon, else: # on les place aux sommets - body.addContactors(group='right',type='CLxxx',color=colors[1]) + body.addContactors(group='right',shape='CLxxx',color=colors[1]) # on deplace les noeuds situes : # * dans le coin inferieur droit de la brique _moveContactorCLxxx(coor=[x0 + self.lx, y0], body=body, color=colors[1], apab=apabvc) @@ -234,10 +232,10 @@ return body
# creation d'une brique deformable, explosee -
[docs] def explodedDeformableBrick(self, center, material, model, type='4T3', +
[docs] def explodedDeformableBrick(self, center, material, model, mesh_type='4T3', nb_elem_x=1, nb_elem_y=1, apabh=None, apabv=None, apabhc=0.25, apabvc=0.25, colors=['HORIx', 'VERTx', 'HORIx', 'VERTx'], color='BLEUx', shift=0): - '''explodedDeformableBrick(self, center, material, model, type='4T3', + '''explodedDeformableBrick(self, center, material, model, mesh_type='4T3', nb_elem_x=1, nb_elem_y=1, apabh=None, apabv=None, apabhc=0.25, apabvc=0.25, colors=['HORIx', 'VERTx', 'HORIx', 'VERTx'], color='BLEUx', shift=0): @@ -252,7 +250,7 @@ optional parameters : - - type='4T3': meshing strategy for the brick + - mesh_type='4T3': meshing strategy for the brick (possible values: 'Q4', 'Q8', '2T3' and '4T3') - nb_elem_x: number of elements Q4 following direction Ox - nb_elem_y: number of elements Q4 following direction Oy @@ -272,7 +270,7 @@ x0=center[0] - 0.5*self.lx y0=center[1] - 0.5*self.ly # on genere le maillage de la brique - mesh_brick=buildMesh2D(type, x0, y0, self.lx, self.ly, nb_elem_x, nb_elem_y) + mesh_brick=buildMesh2D(mesh_type, x0, y0, self.lx, self.ly, nb_elem_x, nb_elem_y) # on contruit un corps maille a partir du maillage de la brique body=buildMeshedAvatar(mesh=mesh_brick, model=model, material=material) # on explose le corps maille represenant la brique @@ -282,20 +280,20 @@ # on ajoute les contacteurs : # * une ligne antagoniste sur le dessus du bloc if new_body.hasGroup('up'): - new_body.addContactors(group='up',type='ALpxx',color=colors[2]) + new_body.addContactors(group='up',shape='ALpxx',color=colors[2]) # * les points candidats sur le dessous du bloc if new_body.hasGroup('down'): # si on donne des positions pour le points de contacts, on les # utilise if ( apabh ): - #body.addContactors(group='down',type='CLxxx',color=colors[0], + #body.addContactors(group='down',shape='CLxxx',color=colors[0], # connex='no', weights=apabh) - body.addContactors(group='down',type='CLxxx',color=colors[0], + body.addContactors(group='down',shape='CLxxx',color=colors[0], weights=apabh) # sinon, else: # on les place aux sommets - new_body.addContactors(group='down',type='CLxxx',color=colors[0]) + new_body.addContactors(group='down',shape='CLxxx',color=colors[0]) # on deplace les noeuds situes : # * dans le coin inferieur gauche de la brique _moveContactorCLxxx(coor=[x0, y0], body=new_body, color=colors[0], apab=apabhc) @@ -304,20 +302,20 @@ # * une ligne antagoniste sur le cote gauche du bloc if new_body.hasGroup('left'): - new_body.addContactors(group='left',type='ALpxx',color=colors[3]) + new_body.addContactors(group='left',shape='ALpxx',color=colors[3]) # * les points candidats sur le cote droit du bloc if new_body.hasGroup('right'): # si on donne des positions pour le points de contacts, on les # utilise if ( apabv ): - #body.addContactors(group='right',type='CLxxx',color=colors[1], + #body.addContactors(group='right',shape='CLxxx',color=colors[1], # connex='no', weights=apabv) - body.addContactors(group='right',type='CLxxx',color=colors[1], + body.addContactors(group='right',shape='CLxxx',color=colors[1], weights=apabv) # sinon, else: # on les place aux sommets - new_body.addContactors(group='right',type='CLxxx',color=colors[1]) + new_body.addContactors(group='right',shape='CLxxx',color=colors[1]) # on deplace les noeuds situes : # * dans le coin inferieur droit de la brique _moveContactorCLxxx(coor=[x0 + self.lx, y0], body=new_body, color=colors[1], apab=apabvc) @@ -328,7 +326,7 @@ return bodies
# classe brique 3D -
[docs]class brick3D: +
[docs]class brick3D(): '''class designed to build rigid bricks in 3D Methods: @@ -359,7 +357,7 @@ self.lz=lz # hauteur # creation d'une brique rigide -
[docs] def rigidBrick(self, center, model, material, color='BLEUx'): +
[docs] def rigidBrick(self, center, model, material, color='BLEUx'): '''rigidBrick(self, center, model, material, color='BLEUx'): this function build and returns a rigid brick @@ -376,13 +374,11 @@ ''' # creation d'une nouvelle brique rigide - body = avatar(type='RBDY3', dimension=3) + body = avatar(dimension=3) # on lui attribue un comportement volumique de type rigide body.addBulk( rigid3d() ) # ajout de la position du centre d'inertie de la brique - body.addNode( - node(type='NO3xx',coor=numpy.array(center), - number=1) ) + body.addNode( node(coor=numpy.array(center), number=1) ) # on definit les groupes pour la brique body.defineGroups() # on affecte son modele rigide a la brique @@ -481,7 +477,7 @@ connectivity[11, 2]=6 # on peut alors ajouter son contacteur polygone a la brique - body.addContactors(type='POLYR', color=color, nb_vertices=8, nb_faces=12, + body.addContactors(shape='POLYR', color=color, nb_vertices=8, nb_faces=12, vertices=vertices, connectivity=connectivity) # on calcule le volume et l'inertie de la brique @@ -517,7 +513,7 @@ # pour chaque contacteur du corps for contact in body.contactors: # si le contacteur n'est pas un CLxxx - if contact.type != 'CLxxx': + if contact.shape != 'CLxxx': # on passe au suivant continue # si le contacteur n'a pas la bonne couleur @@ -552,8 +548,8 @@ \ No newline at end of file diff --git a/docs/Pre/_modules/pylmgc90/pre_lmgc/build_avatar/brick_wall.html b/docs/Pre/_modules/pylmgc90/pre/build_avatar/brick_wall.html similarity index 95% rename from docs/Pre/_modules/pylmgc90/pre_lmgc/build_avatar/brick_wall.html rename to docs/Pre/_modules/pylmgc90/pre/build_avatar/brick_wall.html index 5951ef42969a96e47f2c4ca0a0cd33b3c6ded2cb..a74036a231efb806467189090a4797e4015e8b57 100644 --- a/docs/Pre/_modules/pylmgc90/pre_lmgc/build_avatar/brick_wall.html +++ b/docs/Pre/_modules/pylmgc90/pre/build_avatar/brick_wall.html @@ -6,7 +6,7 @@ - pylmgc90.pre_lmgc.build_avatar.brick_wall — pylmgc90.pre 2015.2 documentation + pylmgc90.pre.build_avatar.brick_wall — pylmgc90.pre 2015.2 documentation @@ -46,18 +46,18 @@
-

Source code for pylmgc90.pre_lmgc.build_avatar.brick_wall

+  

Source code for pylmgc90.pre.build_avatar.brick_wall

 # module definissant des classes "murs de brique"
 import sys
-from pylmgc90.pre_lmgc.avatars import *
+from pylmgc90.pre.avatars import *
 from brick_row import *
-from pylmgc90.pre_lmgc.utilities.error    import *
+from pylmgc90.pre.utilities.error    import *
 
 # classe definissant un mur construit avec un apareil type paneresse generique, i.e. la classe fournit
 # toutes les fonctions pour donner ou calculer le nombre de rangees, la hauteur du mur, la taille du joint
 # mais pas la methode de construction
-class paneresse_generic:
-   """class paneresse_generic:
+class paneresse_generic():
+   """class paneresse_generic():
       this class defines an objet representing a wall, using the so called "apareil en paneresses"
    """
 
@@ -519,7 +519,7 @@
 # classe definissant un mur construit avec un apareil type paneresse simple, i.e. permet de construire un
 # mur avec apareil en paneresse simple, pour des briques disposees en paneresse, un apraeil en boutisse
 # pour des briques disposees en boutisse, et sur chant pour des briques disposees sur chant
-
[docs]class paneresse_simple(paneresse_generic): +
[docs]class paneresse_simple(paneresse_generic): """class paneresse_simple: this class defines an objet representing a brick wall, using the so called "apareil en paneresses, simple" @@ -540,7 +540,7 @@ # pose le mur de briques sous la forme de corps rigides (modele, materiau, couleurs), par rapport a une origine donnee 0 # le parement exterieur se trouve dans le plan xOz, et les briques sont posees suivant l'axe Ox -
[docs] def buildRigidWall(self, origin, model, material, colors=['BLEUx', 'REDxx'], rtol=1e-5): +
[docs] def buildRigidWall(self, origin, model, material, colors=['BLEUx', 'REDxx'], rtol=1e-5): """buildRigidWall(self, origin, model, material, color, rtol=1e-5): this function builds the wall, as it generates a list of rigid avatars representing bricks of the wall @@ -598,7 +598,7 @@ # le parement exterieur se trouve dans le plan xOz, et les briques sont posees suivant l'axe Ox # le mur genere par cette focntion est pret pour le harpage, puisque les demi-briques pouvant aparaitre au debut ou la fin de # chaque rangee ne sont pas posees -
[docs] def buildRigidWallWithoutHalfBricks(self, origin, model, material, colors=['BLEUx', 'REDxx'], rtol=1e-5): +
[docs] def buildRigidWallWithoutHalfBricks(self, origin, model, material, colors=['BLEUx', 'REDxx'], rtol=1e-5): """buildRigidWallWithoutHalfBricks(self, origin, model, material, color, rtol=1e-5): this function builds the wall, as it generates a list of rigid avatars representing bricks of the wall ; @@ -663,7 +663,7 @@ # classe definissant un mur construit avec un apareil type paneresse simple, i.e. permet de construire un # mur avec apareil en paneresse simple, pour des briques disposees en paneresse et sur chant pour des briques disposees sur chant -
[docs]class paneresse_double(paneresse_generic): +
[docs]class paneresse_double(paneresse_generic): """class paneresse_double: this class defines an objet representing a brick wall, using the so called "apareil en paneresses, double" @@ -692,7 +692,7 @@ # pose le mur de briques sous la forme de corps rigides (modele, materiau, couleurs), par rapport a une origine donnee 0 # le parement exterieur se trouve dans le plan xOz, et les briques sont posees suivant l'axe Ox -
[docs] def buildRigidWall(self, origin, model, material, colors=['BLEUx', 'REDxx', 'JAUNE', 'VERTx'], rtol=1e-5): +
[docs] def buildRigidWall(self, origin, model, material, colors=['BLEUx', 'REDxx', 'JAUNE', 'VERTx'], rtol=1e-5): """buildRigidWall(self, origin, model, material, colors, rtol=1e-5): this function builds the wall, as it generates a list of rigid avatars representing bricks of the wall @@ -768,8 +768,8 @@ \ No newline at end of file diff --git a/docs/Pre/_modules/pylmgc90/pre_lmgc/build_avatar/extrusion.html b/docs/Pre/_modules/pylmgc90/pre/build_avatar/extrusion.html similarity index 82% rename from docs/Pre/_modules/pylmgc90/pre_lmgc/build_avatar/extrusion.html rename to docs/Pre/_modules/pylmgc90/pre/build_avatar/extrusion.html index a275a82b56cf7230ced9f062d29f0b321aa2dc74..ebe587a09825e292ba238b1e255429d81038e4df 100644 --- a/docs/Pre/_modules/pylmgc90/pre_lmgc/build_avatar/extrusion.html +++ b/docs/Pre/_modules/pylmgc90/pre/build_avatar/extrusion.html @@ -6,7 +6,7 @@ - pylmgc90.pre_lmgc.build_avatar.extrusion — pylmgc90.pre 2015.2 documentation + pylmgc90.pre.build_avatar.extrusion — pylmgc90.pre 2015.2 documentation @@ -46,7 +46,7 @@
-

Source code for pylmgc90.pre_lmgc.build_avatar.extrusion

+  

Source code for pylmgc90.pre.build_avatar.extrusion

 # module qui fournit des macros pour extruder des corps rigides 2D
 
 import sys
@@ -54,15 +54,15 @@
 import math
 import copy
 
-from pylmgc90.pre_lmgc.avatar.avatar import *
-from pylmgc90.pre_lmgc.avatar.bulk.rigid3d import *
-from pylmgc90.pre_lmgc.avatars import *
-from pylmgc90.pre_lmgc.utilities.error    import *
+from pylmgc90.pre.avatar.avatar import *
+from pylmgc90.pre.avatar.bulk.rigid3d import *
+from pylmgc90.pre.avatars import *
+from pylmgc90.pre.utilities.error    import *
 
 from mesh import *
 
 # fonction qui extrude un rigide 2D (defini dans le plan xOy), suivant l'axe Oz
-
[docs]def extrudeRigid(body2D, model3D, depth, factor=1.e0, extrudedDisk='Sphere', number=None): +
[docs]def extrudeRigid(body2D, model3D, depth, factor=1.e0, extrudedDisk='Sphere', number=None): '''extrudeRigid(body2D, model3D, depth, factor=1.e0, number=None): this function builds a 3D rigid body by extruding a given 2D rigid avatar and returns @@ -94,13 +94,13 @@ showError("In extrudeRigid: first argument of this function must be an avatar!") # verification du type d'avatar - if body2D.type != 'RBDY2': + if body2D.atype != 'RBDY2': showError("In extrudeRigid: first argument of this function must be a rigid avatar!") # creation d'un nouveau corps rigide 3D # N.B.: on ne renseigne ni le rayoin pour la masse, ni les inerties # principales pour qu'elles soient calculees par LMGC90 - body3D = avatar(type='RBDY3', dimension=3, number=number) + body3D = avatar(dimension=3, number=number) # on lui attribue un comportement volumique de type rigide body3D.addBulk( rigid3d() ) @@ -114,14 +114,14 @@ # on determine si le coprs possede (au moins) un contacteur polygone has_polygon = False for contactor in body2D.contactors: - if contactor.type == 'POLYG': + if contactor.shape == 'POLYG': has_polygon = True break # on determine si le corps est un jonc (i.e. possede un contacteur jonc) is_jonc = False for contactor in body2D.contactors: - if contactor.type == 'JONCx': + if contactor.shape == 'JONCx': is_jonc = True break @@ -130,7 +130,7 @@ # on place le centre d'inertie a l'origine, pour que LMGC90 le # recalcule a partir des positions des contacteurs (sommets ou centres) body3D.addNode( - node(type='NO3xx',coor=numpy.array([0., 0., 0.]), + node(coor=numpy.array([0., 0., 0.]), number=1) ) # sinon, else: @@ -138,14 +138,14 @@ if is_jonc: # on place le centre d'inertie dans le plan y = depth/2 body3D.addNode( - node(type='NO3xx',coor=numpy.array([factor*mass_center[0], + node(coor=numpy.array([factor*mass_center[0], 0.5*depth, factor*mass_center[1]]), number=1) ) # sinon, else: # on place le centre d'inertie dans le plan z = depth/2 # N.B. : le corps est donc un disque (creux ou plein) body3D.addNode( - node(type='NO3xx',coor=numpy.array([factor*mass_center[0], + node(coor=numpy.array([factor*mass_center[0], factor*mass_center[1], 0.5*depth]), number=1) ) # on definit les groupes pour le corps @@ -160,15 +160,15 @@ try: try: # on tente de calculer le type et les options du contacteur constituant l'extrusion 3D du contacteur courant - type, options=contactor.extrusion(mass_center=mass_center, depth=depth, factor=factor, extrudedDisk=extrudedDisk) + shape, options=contactor.extrusion(mass_center=mass_center, depth=depth, factor=factor, extrudedDisk=extrudedDisk) # si ca reussi, on ajoute le contacteur au corps resulatant de l'extrusion - body3D.addContactors(type=type, color=contactor.color, **options) + body3D.addContactors(shape=shape, color=contactor.color, **options) except ValueError, e: # si on echoue a cause de la valeur d'une option, on affiche le warning ad hoc showWarning(str(e)) except NotImplementedError: # si on echoue parce que le contatceur n'a pas defini sa facon d'etre extrude, on previent l'utilisateur - showWarning("In extrudeRigid: a contactor " + contactor.type + " CANNOT be extruded! Skipping.") + showWarning("In extrudeRigid: a contactor " + contactor.shape + " CANNOT be extruded! Skipping.") # si le corps n'est pas un jonc, on passe la face extrude (z=depth) du plan xOy, au plan xOz (y=0) if not is_jonc: @@ -184,7 +184,7 @@ # fonction qui extrude un ensemble de corps rigides 2D et place # les corps extrudes dans le plan xOz -
[docs]def extrudeRigids(bodies2D, model3D, depth, factor=1.e0, extrudedDisk='Sphere', number=None): +
[docs]def extrudeRigids(bodies2D, model3D, depth, factor=1.e0, extrudedDisk='Sphere', number=None): '''extrudeRigids(bodies2D, model3D, depth, factor=1.e0, number=None): this function extrudes each avatar in a given avatar container and returns @@ -267,7 +267,7 @@ for l in range(nb_lz+1): for n in m.nodes: new_coor = numpy.array([n.coor[0],n.coor[1],l*lz/nb_lz]) - vol_mesh.addNode(node(type='NO3xx',coor=new_coor,number=l*nb_nodes+n.number)) + vol_mesh.addNode(node(coor=new_coor,number=l*nb_nodes+n.number)) #adding elements for i, e in enumerate(m.bulks): @@ -299,13 +299,14 @@ nnew_c = [ c+l*nb_nodes for c in new_c ] vol_mesh.addBulk(element(connec_type[elem_size], nnew_c, e.physicalEntity+'E',e.geometricalEntity)) + elem_dim = geoElement2dimension[e.etype] #needs to add original surfacic elements on top and bottom if perm: - vol_mesh.addBulk(element(e.type, e.connectivity, e.physicalEntity+'B',e.geometricalEntity)) - vol_mesh.addBulk(element(e.type, [x+nb_lz*nb_nodes for x in e.connectivity[::-1]], e.physicalEntity+'T',e.geometricalEntity)) + vol_mesh.addBulk(element(elem_dim, e.connectivity, e.physicalEntity+'B',e.geometricalEntity)) + vol_mesh.addBulk(element(elem_dim, [x+nb_lz*nb_nodes for x in e.connectivity[::-1]], e.physicalEntity+'T',e.geometricalEntity)) else: - vol_mesh.addBulk(element(e.type, e.connectivity[::-1], e.physicalEntity+'B',e.geometricalEntity)) - vol_mesh.addBulk(element(e.type, [x+nb_lz*nb_nodes for x in e.connectivity], e.physicalEntity+'T',e.geometricalEntity)) + vol_mesh.addBulk(element(elem_dim, e.connectivity[::-1], e.physicalEntity+'B',e.geometricalEntity)) + vol_mesh.addBulk(element(elem_dim, [x+nb_lz*nb_nodes for x in e.connectivity], e.physicalEntity+'T',e.geometricalEntity)) return vol_mesh @@ -319,8 +320,8 @@ \ No newline at end of file diff --git a/docs/Pre/_modules/pylmgc90/pre_lmgc/build_avatar/lattices2D.html b/docs/Pre/_modules/pylmgc90/pre/build_avatar/lattices2D.html similarity index 94% rename from docs/Pre/_modules/pylmgc90/pre_lmgc/build_avatar/lattices2D.html rename to docs/Pre/_modules/pylmgc90/pre/build_avatar/lattices2D.html index 1233aaef29e706e1b2537da8f68b3bfa2833b95b..15fd2b1a48a53afb7135f7ba2c490b2b6a6c428d 100644 --- a/docs/Pre/_modules/pylmgc90/pre_lmgc/build_avatar/lattices2D.html +++ b/docs/Pre/_modules/pylmgc90/pre/build_avatar/lattices2D.html @@ -6,7 +6,7 @@ - pylmgc90.pre_lmgc.build_avatar.lattices2D — pylmgc90.pre 2015.2 documentation + pylmgc90.pre.build_avatar.lattices2D — pylmgc90.pre 2015.2 documentation @@ -46,13 +46,13 @@
-

Source code for pylmgc90.pre_lmgc.build_avatar.lattices2D

+  

Source code for pylmgc90.pre.build_avatar.lattices2D

 # module dedie au depot de particules sur un reseau
 
 import sys
 import numpy
 import math
-from pylmgc90.pre_lmgc.utilities.error    import *
+from pylmgc90.pre.utilities.error    import *
 
 # fonction qui genere une liste de coordonnees sur un reseau carre
 # parametres :
@@ -71,7 +71,7 @@
 #          max(rayons) <= l/2
 #    2. l'ensemble particules deposees sur ce resau est inclus dans une boite 
 #       rectangulaire de dimensions : nb_ele*l x nb_layer*l
-
[docs]def squareLattice2D(nb_ele, nb_layer, l, x0=0., y0=0.): +
[docs]def squareLattice2D(nb_ele, nb_layer, l, x0=0., y0=0.): '''coor=squareLattice2D(nb_ele, nb_layer, l, x0=0., y0=0.): this function compute a list of positions on a square lattice @@ -196,7 +196,7 @@ showError(str(orientation) + " is not an orientation!") # fonction qui genere une liste de coordonnees sur un reseau triangulaire -
[docs]def triangularLattice2D(nb_ele, nb_layer, l, x0=0., y0=0., orientation='up'): +
[docs]def triangularLattice2D(nb_ele, nb_layer, l, x0=0., y0=0., orientation='up'): '''coor=triangularLattice2D(nb_ele, nb_layer, l, x0=0., y0=0., orientation='up'): this function compute a list of positions on an equilateral triangular lattice @@ -293,8 +293,8 @@ \ No newline at end of file diff --git a/docs/Pre/_modules/pylmgc90/pre_lmgc/build_avatar/lattices3D.html b/docs/Pre/_modules/pylmgc90/pre/build_avatar/lattices3D.html similarity index 91% rename from docs/Pre/_modules/pylmgc90/pre_lmgc/build_avatar/lattices3D.html rename to docs/Pre/_modules/pylmgc90/pre/build_avatar/lattices3D.html index a336a3cf711e28a09149c27f5e68e963c561a518..2c7e1801bcf83b87222743b91bfa3bb6722460d5 100644 --- a/docs/Pre/_modules/pylmgc90/pre_lmgc/build_avatar/lattices3D.html +++ b/docs/Pre/_modules/pylmgc90/pre/build_avatar/lattices3D.html @@ -6,7 +6,7 @@ - pylmgc90.pre_lmgc.build_avatar.lattices3D — pylmgc90.pre 2015.2 documentation + pylmgc90.pre.build_avatar.lattices3D — pylmgc90.pre 2015.2 documentation @@ -46,7 +46,7 @@
-

Source code for pylmgc90.pre_lmgc.build_avatar.lattices3D

+  

Source code for pylmgc90.pre.build_avatar.lattices3D

 # module dedie au depot de particules sur un reseau
 
 import sys
@@ -75,7 +75,7 @@
 #          max(rayons) <= l/2
 #    2. l'ensemble particules deposees sur ce resau est inclus dans une boite 
 #       rectangulaire de dimensions : nb_ele_x*l x nb_ele_y*l x nb_layer*l
-
[docs]def cubicLattice3D(nb_ele_x, nb_ele_y, nb_layer, l, x0=0., y0=0., z0=0.): +
[docs]def cubicLattice3D(nb_ele_x, nb_ele_y, nb_layer, l, x0=0., y0=0., z0=0.): '''coor=cubicLattice3D(nb_ele_x, nb_ele_y, nb_layer, l, x0=0., y0=0., z0=0.): this function compute a list of positions on a cubic lattice @@ -132,8 +132,8 @@ \ No newline at end of file diff --git a/docs/Pre/_modules/pylmgc90/pre_lmgc/build_avatar/lecture.html b/docs/Pre/_modules/pylmgc90/pre/build_avatar/lecture.html similarity index 61% rename from docs/Pre/_modules/pylmgc90/pre_lmgc/build_avatar/lecture.html rename to docs/Pre/_modules/pylmgc90/pre/build_avatar/lecture.html index b4c3a068a79371e09a223f03f7b772f791dca20e..ec8a30f47315ee82a6ef7159d270cb5650368492 100644 --- a/docs/Pre/_modules/pylmgc90/pre_lmgc/build_avatar/lecture.html +++ b/docs/Pre/_modules/pylmgc90/pre/build_avatar/lecture.html @@ -6,7 +6,7 @@ - pylmgc90.pre_lmgc.build_avatar.lecture — pylmgc90.pre 2015.2 documentation + pylmgc90.pre.build_avatar.lecture — pylmgc90.pre 2015.2 documentation @@ -46,7 +46,7 @@
-

Source code for pylmgc90.pre_lmgc.build_avatar.lecture

+  

Source code for pylmgc90.pre.build_avatar.lecture

 # MODULE lecture
 # 
 # Module permettant la lecture des differents formats
@@ -73,19 +73,19 @@
 
 import os,string,sys
 
-from pylmgc90.pre_lmgc.config.readMeshFormat import *
-from pylmgc90.pre_lmgc.config.lmgc90dicts import *
+from pylmgc90.pre.config.readMeshFormat import *
+from pylmgc90.pre.config.lmgc90dicts import *
 
-from pylmgc90.pre_lmgc.avatar.nodes        import *
-from pylmgc90.pre_lmgc.avatar.node.node    import *
-from pylmgc90.pre_lmgc.avatar.bulks        import *
-from pylmgc90.pre_lmgc.avatar.bulk.element import *
+from pylmgc90.pre.avatar.nodes        import *
+from pylmgc90.pre.avatar.node.node    import *
+from pylmgc90.pre.avatar.bulks        import *
+from pylmgc90.pre.avatar.bulk.element import *
 from mesh import *
-from pylmgc90.pre_lmgc.utilities.error    import *
+from pylmgc90.pre.utilities.error    import *
 
 ## routine de lecture du fichier maillage
 #@todo gerer l'extension med
-
[docs]def lecture(name, dim, keep_elements=None, scale_factor=None, incomplete_elements=None): +
[docs]def lecture(name, dim, keep_elements=None, scale_factor=None, incomplete_elements=True): """lecture(name, dim): this function builds sets of nodes and elements by reading a file @@ -150,11 +150,7 @@ # si le mot clef lu est "MeshFormat" et que le numero de version est 2 ou 2.x if (res0[0] == '$MeshFormat' and (res1[0] == "2" or res1[0].startswith("2."))): - # c'est un fichier au format 2.x - if ( incomplete_elements ): - read_mesh = gmshv2(mesh_file, dim, keep_elements, incomplete_elements) - else: - read_mesh = gmshv2(mesh_file, dim, keep_elements, []) + read_mesh = readGmshv2(mesh_file, dim, keep_elements, incomplete_elements) # sinon, else: # c'est un fichier au format 1.0, qui n'a pas d'en-tete @@ -163,15 +159,18 @@ mesh_file.close() mesh_file = open(name, 'r') # on lit le fichier - read_mesh = gmshv1(mesh_file, dim) + read_mesh = readGmshv1(mesh_file, dim) # * cas du maillage maillage sysweld elif name.endswith('txt'): - read_mesh = sysweld(mesh_file, dim) + read_mesh = readSysweld(mesh_file, dim) # * cas du maillage maillage au format MED #elif name.endswith('med'): # * cas du maillage maillage au format MAIL elif name.endswith('mail'): - read_mesh = mail(mesh_file, dim) + read_mesh = readMail(mesh_file, dim) + # * cas du maillage maillage au format VTK + elif name.endswith('vtu'): + read_mesh = readVtu(name, dim, keep_elements) # si on a donne un facteur d'echelle if scale_factor != None: @@ -183,8 +182,8 @@ # on renvoie le maillage lu dans le fichier return read_mesh
-def gmshv1(mesh_file, dim): - """gmshv1(mesh_file, dim): +def readGmshv1(mesh_file, dim): + """readGmshv1(mesh_file, dim): this function builds sets of nodes and elements from a mesh built by gmsh, and using format 1.0 @@ -220,22 +219,27 @@ if motcle == '$NOD' and res[0]!='$NOD' and len(res) > 1: # si on est en 2D if dim == 2: - # on lit un noeud a deux composantes - type = 'NO2xx' coor = numpy.array( [ float(res[1]), float(res[2]) ] ) # si on est en 3D elif dim == 3: - # on lit un noeud a trois composantes - type = 'NO3xx' coor = numpy.array( [ float(res[1]), float(res[2]), float(res[3]) ] ) # on ajoute le noeud lu au maillage - read_mesh.addNode(node(type=type,coor=coor,number=int(res[0]))) + read_mesh.addNode(node(coor=coor,number=int(res[0]))) # si le dernier mot-clef lu est le debut de la section des elements, # et qu'on a pas atteint la fin de cette section # N.B.: le test 'len(res) > 1' permet de sauter la ligne donnant le nombre d'elements if motcle == '$ELM' and res[0]!='$ELM' and len(res) > 1 : # on lit le nouvel element et on l'ajoute au maillage - read_mesh.addBulk(element(type=gmsh2lmgc_element[res[1]], connectivity=map(int,res[5:]), physicalEntity=res[2], number=int(res[0]))) + if res[1] in gmshElementPoint: + read_mesh.addBulk(element(elem_dim=0, connectivity=map(int,res[5:]), physicalEntity=res[2], number=int(res[0]))) + elif res[1] in gmshElementLine: + read_mesh.addBulk(element(elem_dim=1, connectivity=map(int,res[5:]), physicalEntity=res[2], number=int(res[0]))) + elif res[1] in gmshElementSurface: + read_mesh.addBulk(element(elem_dim=2, connectivity=map(int,res[5:]), physicalEntity=res[2], number=int(res[0]))) + elif res[1] in gmshElementVolume: + read_mesh.addBulk(element(elem_dim=3, connectivity=map(int,res[5:]), physicalEntity=res[2], number=int(res[0]))) + else: + showError("[lecture::gmsh] : unknown gmsh element type: "+res[1]) # on ferme le fichier contenant le mailage mesh_file.close() @@ -243,8 +247,8 @@ # on renvoie le maillage ainsi construit return read_mesh -def gmshv2(mesh_file, dim, keep_elements, incomplete_elements): - """gmshv2(mesh_file, dim, keep_elements, incomplete_elements): +def readGmshv2(mesh_file, dim, keep_elements, incomplete_elements): + """readGmshv2(mesh_file, dim, keep_elements, incomplete_elements): this function builds sets of nodes and elements from a mesh built by gmsh, and using format 2.x @@ -292,26 +296,30 @@ if motcle == '$Nodes' and res[0]!='$Nodes' and len(res) > 1: # si on est en 2D if dim == 2: - # on lit un noeud a deux composantes - type = 'NO2xx' coor = numpy.array( [ float(res[1]), float(res[2]) ] ) # si on est en 3D elif dim == 3: - # on lit un noeud a trois composantes - type = 'NO3xx' coor = numpy.array( [ float(res[1]), float(res[2]), float(res[3]) ] ) # on ajoute le noeud lu au maillage - read_mesh.addNode(node(type=type,coor=coor,number=int(res[0]))) + read_mesh.addNode(node(coor=coor,number=int(res[0]))) # si le dernier mot-clef lu est le debut de la section des elements, # et qu'on a pas atteint la fin de cette section # N.B.: le test 'len(res) > 1' permet de sauter la ligne donnant le nombre d'elements if motcle == '$Elements' and res[0]!='$Elements' and len(res) > 1 : # on lit le nouvel element et on l'ajoute a la liste des elements - # on recupere : - # * le type de l'element (et on le passe au format LMGC90) - type_lmgc = gmshv22lmgc_element[res[1]] + if res[1] in gmshv2ElementPoint: + elem_dim = 0 + elif res[1] in gmshv2ElementLine: + elem_dim = 1 + elif res[1] in gmshv2ElementSurface: + elem_dim = 2 + elif res[1] in gmshv2ElementVolume: + elem_dim = 3 + else: + showError("[lecture::readGmshv2] : unknown gmsh element type: "+res[1]) + # on recupere : # * le nombre de tags (et on le passe en entier) nb_tags = int(res[2]) # s'il y a au moins un tag @@ -327,41 +335,44 @@ # si le filtrage des elements est active et que l'element ne fait pas # partie des elements conserves - if keep_elements != [] and not type_lmgc in keep_elements: + if keep_elements != [] and not elem_dim in keep_elements: # on passe au suivant continue - if type_lmgc == 'TE10x': + if res[1] == '11': # TE10 + # on permute la numerotation des noeuds de l'element pour retrouver l'ordre choisi dans LMGC90 conn_TE10 = [conn[0], conn[1], conn[2], conn[3], conn[4], conn[5], conn[6], conn[7], conn[9], conn[8]] # on construit l'element et on l'ajoute au maillage - read_mesh.addBulk(element(type=type_lmgc, connectivity=conn_TE10, physicalEntity=pE, geometricalEntity=gE, number=int(res[0]))) + read_mesh.addBulk(element(elem_dim=elem_dim, connectivity=conn_TE10, physicalEntity=pE, geometricalEntity=gE, number=int(res[0]))) - elif type_lmgc == 'H20xx': - # si l'element est un H20 - # on permute la numerotation des noeuds de l'element pour retrouver l'ordre choisi dans LMGC90 - conn_H20 = [conn[0], conn[1], conn[2], conn[3], conn[4], conn[5], conn[6], conn[7], - conn[8], conn[11], conn[13], conn[9], conn[16], conn[18], conn[19], conn[17], - conn[10], conn[12], conn[14], conn[15]] + if res[1] == '13' or (res[1]=='18' and incomplete_elements) : + # on permute la numerotation des noeuds de l'element pour retrouver l'ordre choisi dans LMGC90 + conn_PRI15 = [conn[0] , conn[1] , conn[2], conn[3] , conn[4] , + conn[5] , conn[6] , conn[9], conn[7] , conn[12], + conn[14], conn[13], conn[8], conn[10], conn[11]] # on construit l'element et on l'ajoute au maillage - read_mesh.addBulk(element(type=type_lmgc, connectivity=conn_H20, physicalEntity=pE, geometricalEntity=gE, number=int(res[0]))) + read_mesh.addBulk(element(elem_dim=elem_dim, connectivity=conn_PRI15, physicalEntity=pE, geometricalEntity=gE, number=int(res[0]))) - elif type_lmgc == 'Q8xxx': - # si l'element est un Q8 - conn_Q8 = [conn[0], conn[1], conn[2], conn[3], conn[4], conn[5], conn[6], conn[7]] + elif res[1] == '17' or (res[1]=='12' and incomple_elements) : + # on permute la numerotation des noeuds de l'element pour retrouver l'ordre choisi dans LMGC90 + conn_H20 = [conn[0] , conn[1] , conn[2] , conn[3] , conn[4] , + conn[5] , conn[6] , conn[7] , conn[8] , conn[11], + conn[13], conn[9] , conn[16], conn[18], conn[19], + conn[17], conn[10], conn[12], conn[14], conn[15]] # on construit l'element et on l'ajoute au maillage - read_mesh.addBulk(element(type=type_lmgc, connectivity=conn_Q8, physicalEntity=pE, geometricalEntity=gE, number=int(res[0]))) + read_mesh.addBulk(element(elem_dim=elem_dim, connectivity=conn_H20, physicalEntity=pE, geometricalEntity=gE, number=int(res[0]))) - elif type_lmgc == 'Q9xxx' and type_lmgc in incomplete_elements: + elif res[1] == '10' and incomplete_elements: # si l'element est un Q9 on lit un Q8 conn_Q8 = [conn[0], conn[1], conn[2], conn[3], conn[4], conn[5], conn[6], conn[7]] # on construit l'element et on l'ajoute au maillage - read_mesh.addBulk(element(type='Q8xxx', connectivity=conn_Q8, physicalEntity=pE, geometricalEntity=gE, number=int(res[0]))) + read_mesh.addBulk(element(elem_dim=elem_dim, connectivity=conn_Q8, physicalEntity=pE, geometricalEntity=gE, number=int(res[0]))) else: @@ -381,7 +392,7 @@ #print xx if xx < 0.: - if type_lmgc == 'T6xxx': + if len(conn)==6 : conn0=copy.deepcopy(conn) conn = [conn0[0],conn0[2],conn0[1],conn0[5],conn0[4],conn[3]] else: @@ -392,7 +403,7 @@ # on construit l'element et on l'ajoute au maillage - read_mesh.addBulk(element(type=type_lmgc, connectivity=conn, physicalEntity=pE, geometricalEntity=gE, number=int(res[0]))) + read_mesh.addBulk(element(elem_dim=elem_dim, connectivity=conn, physicalEntity=pE, geometricalEntity=gE, number=int(res[0]))) # si le dernier mot-clef lu est le debut de la section des noms des entites physiques, # et qu'on a pas atteint la fin de cette section @@ -436,8 +447,8 @@ # on renvoie le maillage ainsi construit return read_mesh -def sysweld(mesh_file,dim): - """sysweld(mesh_file, dim): +def readSysweld(mesh_file,dim): + """readSysweld(mesh_file, dim): this function builds sets of nodes and elements from a mesh built by sysweld @@ -482,25 +493,22 @@ if motcle == 'NOEUD' and res[0]=='NOEUD': # si on est en 2D if dim == 2: - # on lit un noeud a deux composantes - type = 'NO2xx' - coor = numpy.array( [ float(res[5]), float(res[7]) ] ) + coor = numpy.array( [ float(res[5]), float(res[7]) ] ) # si on est en 3D elif dim == 3: - # on lit un noeud a trois composantes - type = 'NO3xx' - coor = numpy.array( [ float(res[5]), float(res[7]), float(res[9]) ] ) - read_mesh.addNode(node(type=type,coor=coor,number=int(res[0]))) + coor = numpy.array( [ float(res[5]), float(res[7]), float(res[9]) ] ) + read_mesh.addNode(node(coor=coor,number=int(res[0]))) # si la ligne courante est la premiere des deux lignes decrivant un element if motcle == 'ELEMENT' and res[0]=='ELEMENT': # on recupere le type, le numero et le groupe du nouvel element - type = res[3] + if res[3] not in sysweldElementSurface: + showError("[lecture::readSysweld] : unknown sysweld element type: "+res[3]) num = res[1] group = res[6] # si la ligne courante est la seconde des deux lignes decrivant un element if motcle == 'ELEMENT' and res[0]!='ELEMENT': # on complete la description du nouvel element et on l'ajoute au maillage - read_mesh.addBulk(element(type=sysweld2lmgc_element[type], connectivity=res[1:], physicalEntity=group)) + read_mesh.addBulk(element(elem_dim=2, connectivity=res[1:], physicalEntity=group)) # on ferme le fichier contenant le mailage mesh_file.close() @@ -508,8 +516,8 @@ # on renvoie le maillage ainsi construit return read_mesh -def mail(mesh_file, dim): - """mail(mesh_file, dim): +def readMail(mesh_file, dim): + """readMail(mesh_file, dim): this function builds a mesh by reading a file using the 'mail' format @@ -530,8 +538,6 @@ 'GROUP_NO', # groupe de noeuds 'FINSF', # fin de section 'FIN') # fin du fichier - # on recupere la liste des types d'elements connus - mail_elements = mail2lmgc_element.keys() # on definit le maillage read_mesh = mesh(dim) @@ -564,18 +570,18 @@ # * si le mot-clef est 'COOR_3D' et que le maillage est 2D if res[0] == 'COOR_3D' and dim == 2: # on affiche un message d'erreur - showError("[lecture::mail] : The file decribes 3D coordinates while you want to build a 2D mesh!") + showError("[lecture::readMail] : The file decribes 3D coordinates while you want to build a 2D mesh!") # si le mot clef est valide, on le stocke motcle=res[0] # si la chaine de la premiere colonne est un nom d'element - if res[0] in mail_elements: + if res[0] in mailElementSurface: # on stocke le type d'element decrit dans la prochaine liste d'elements type_ele=res[0] - # on stocke le type d'element corespondant dans la nomenclature de LMGC90 - type_ele_lmgc=mail2lmgc_element[type_ele] # on le stocke comme un mot clef motcle=res[0] + else: + showError("[lecture::readMail] : unknown mail element type: "+res[0]) # si le dernier mot-clef lu est le debut d'une de noeuds, avec des coordonnees 3D, # et qu'on a pas atteint la fin de cette section # N.B.: le test 'len(res) > 1' permet de sauter la ligne qui contient le mot-clef @@ -584,11 +590,9 @@ num += 1 # on associe l'identifiant du noeud courant a son numero node_id2num[res[0]] = num - # on lit un noeud a trois composantes - type = 'NO3xx' - coor = numpy.array( [ float(res[1]), float(res[2]), float(res[3]) ] ) + coor = numpy.array( [ float(res[1]), float(res[2]), float(res[3]) ] ) # on ajoute le noeud lu au maillage - read_mesh.addNode(node(type=type, coor=coor, number=num)) + read_mesh.addNode(node( coor=coor, number=num)) # si le dernier mot-clef lu est un type d'element # et qu'on a pas atteint la fin de la liste des elements de ce type # N.B.: le test 'len(res) > 1' permet de sauter la ligne qui contient le type de l'element @@ -607,7 +611,7 @@ conn.append(node_id2num[id_node]) # on peut alors construire le nouvel element - ele=element(type=type_ele_lmgc, connectivity=conn) + ele=element(elem_dim=2, connectivity=conn) # on l'ajoute au maillage read_mesh.addBulk(ele) # on associe le nouvel element a son identifiant @@ -638,7 +642,7 @@ # si on a deja associe un groupe a l'element if ele_id2bulk[res[0]].physicalEntity != '1': # on affiche un message d'erreur - showError("[lecture::mail] : A group have been already added to this element!") + showError("[lecture::readMail] : A group have been already added to this element!") # sinon, else: # on associe le groupe courant l'element identifie par l'identifiant courant @@ -667,7 +671,7 @@ # a ce groupe # on ajoute un element point, appuye sur ce noeud, au maillage - read_mesh.addBulk( element(type='Point', connectivity=[node_id2num[res[0]]], physicalEntity=group_name) ) + read_mesh.addBulk( element(elem_dim=0, connectivity=[node_id2num[res[0]]], physicalEntity=group_name) ) # si le dernier mot-clef lu indique la fin du fichier if motcle == 'FIN': # on arrete la lecture du fichier @@ -678,6 +682,122 @@ # on renvoie le maillage ainsi construit return read_mesh + +def readVtu(mesh_file, dim, keep_elements): + """readVtu(mesh_file, dim): + + this function builds sets of nodes and elements from a mesh + built by vtk, and using format vtu + + parameters: + + - mesh_file: a file object coresponding to the file in wherein the mesh is stored + N.B.: the file is supposed to be open for reading + - dim: dim=2, in 2D and dim=3, in 3D + + optional parameters: + + - keep_elements: this parameter is used to filter elements, if + keep_elements=None, no filter used, else keep_elements is the list + of elements types that can be stored in the built mesh, other will be + forgotten + + returned value: + + - read_mesh: the built mesh + """ + + import vtk + + # on utilise le reader vtk des maillages non structure + # Read the source file. + try : + reader = vtk.vtkXMLUnstructuredGridReader() + except: + reader = vtk.vtkUnstructuredGridReader() + reader.SetFileName(mesh_file) + reader.Update() + datavtu = reader.GetOutput() + + # Recuperation du maillage + nb_nodes = int(datavtu.GetNumberOfPoints()) + nb_cells = int(datavtu.GetNumberOfCells()) + + # on definit le dictionnaire associant un nom a certaines entites physiques + physicalEntity2physicalName={} + + # on definit le maillage au format LMGC90 + read_mesh = mesh(dimension=dim) + + # pour chaque noeud du maillage vtu + for i in range(nb_nodes): + coor = numpy.asarray(datavtu.GetPoints().GetPoint(i))[:dim] + read_mesh.addNode(node(coor=coor,number=int(i))) + + # on charge les entites physiques et geometriques par un array nomme PhysicalGroup + PhysicalGroup = datavtu.GetCellData().GetArray('PhysicalGroup') + if PhysicalGroup == None : + showWarning('No physical groups defined on this mesh!') + + # pour chaque element du maillage vtu + for i in range(nb_cells): + vtkid = str(datavtu.GetCellType(i)) + if vtkid in vtkElementPoint: + elem_dim = 0 + elif vtkid in vtkElementLine: + elem_dim = 1 + elif vtkid in vtkElementSurface: + elem_dim = 2 + elif vtkid in vtkElementVolume: + elem_dim = 3 + else: + print int(datavtu.GetCell(i).GetNumberOfPoints()) + showError("[lecture::readVtu] : unknown vtk element type: "+vtkid) + + # filtre des elements non interressant + if keep_elements != [] and not elem_dim in keep_elements: + # on passe au suivant + continue + # lecture d'un element interressant + conn = [] + nb_points = int(datavtu.GetCell(i).GetNumberOfPoints()) + for j in range(nb_points): + conn.append(int(datavtu.GetCell(i).GetPointIds().GetId(j))) + + if vtkid == '13': + conn_PRI6 = [conn[0], conn[2], conn[1], conn[3], conn[5], conn[4]] + conn = conn_PRI6 + elif vtkid == '26': + conn_PRI15 = [conn[0] , conn[2], conn[1] , conn[3] , conn[5] , + conn[4] , conn[8], conn[7] , conn[6] , conn[11], + conn[10], conn[9], conn[12], conn[14], conn[13]] + conn = conn_PRI15 + + if PhysicalGroup <> None : + # on construit les entites physiques et geometriques par un array nomme PhysicalGroup + pE = str(int(PhysicalGroup.GetValue(i))) + gE = str(int(PhysicalGroup.GetValue(i))) + else : + pE = '1' + gE = '1' + + # on construit l'element et on l'ajoute au maillage + read_mesh.addBulk(element(elem_dim=elem_dim, connectivity=conn, physicalEntity=pE, geometricalEntity=gE, number=int(i))) + + # si certaines entites physiques possedent un nom + if len(physicalEntity2physicalName) != 0: + # le nom remplace le numero d'entite physique pour les elements concernes + # on recupere la liste des numeros d'entite physiques concernes + named_physicalEntities=physicalEntity2physicalName.keys() + # pour chaque element + for ele in read_mesh.bulks: + # si un nom est associe a son numero d'entite physique + if ele.physicalEntity in named_physicalEntities: + # on remplace le numero par le nom + ele.physicalEntity = physicalEntity2physicalName[ele.physicalEntity] + + # on renvoie le maillage ainsi construit + return read_mesh
@@ -688,8 +808,8 @@ \ No newline at end of file diff --git a/docs/Pre/_modules/pylmgc90/pre_lmgc/build_avatar/mesh.html b/docs/Pre/_modules/pylmgc90/pre/build_avatar/mesh.html similarity index 91% rename from docs/Pre/_modules/pylmgc90/pre_lmgc/build_avatar/mesh.html rename to docs/Pre/_modules/pylmgc90/pre/build_avatar/mesh.html index 65d2684fad651abe48665d8c3a7ec89ccea6c54f..9893f00eb185f434f381b34367ef6a0052e2a8b0 100644 --- a/docs/Pre/_modules/pylmgc90/pre_lmgc/build_avatar/mesh.html +++ b/docs/Pre/_modules/pylmgc90/pre/build_avatar/mesh.html @@ -6,7 +6,7 @@ - pylmgc90.pre_lmgc.build_avatar.mesh — pylmgc90.pre 2015.2 documentation + pylmgc90.pre.build_avatar.mesh — pylmgc90.pre 2015.2 documentation @@ -46,19 +46,19 @@
-

Source code for pylmgc90.pre_lmgc.build_avatar.mesh

+  

Source code for pylmgc90.pre.build_avatar.mesh

 # module definissant une classe permettant de manipuler un maillage 2D ou 3D
 import sys
 import numpy as np
 import copy
-from pylmgc90.pre_lmgc.avatar.bulks import *
-from pylmgc90.pre_lmgc.avatar.nodes import *
-from pylmgc90.pre_lmgc.avatar.bulk.element import *
-from pylmgc90.pre_lmgc.utilities.error    import *
+from pylmgc90.pre.avatar.bulks import *
+from pylmgc90.pre.avatar.nodes import *
+from pylmgc90.pre.avatar.bulk.element import *
+from pylmgc90.pre.utilities.error    import *
 
 # classe maillage
-
[docs]class mesh: - """class mesh: +
[docs]class mesh(): + """class mesh(): this class defines a mesh object, as a couple of a nodes set and a bulk set. """ @@ -81,7 +81,7 @@ self.bulks = bulks() # fonction qui ajoute un noeud au maillage -
[docs] def addNode(self, noeud): +
[docs] def addNode(self, noeud): """addNode(noeud): this function add a node to the mesh @@ -98,7 +98,7 @@ showError('incompatible size between coor array and dimension')
# fonction qui ajoute un element au maillage -
[docs] def addBulk(self, ele): +
[docs] def addBulk(self, ele): """addBulk(ele): this function add an element to the mesh @@ -113,7 +113,7 @@ self.bulks.addBulk(ele)
# remove nodes not attached to elements -
[docs] def removeFreeNodes(self): +
[docs] def removeFreeNodes(self): """ removeFreeNodes(self) removes nodes not attached to an element """ @@ -142,7 +142,7 @@ # - il se peut aussi que certains noeuds soient inutiles (car on a lu un maillage lineaire # dans un maillage quadratique par exemple) dans ce cas il faut virer les noeuds inutiles et tasser la numerotation -
[docs] def rankRenumbering(self): +
[docs] def rankRenumbering(self): """rankRenumbering(self): this function renumbers the nodes of the mesh, in order to avoid holes in the numbering, i.e. @@ -194,7 +194,7 @@ # fonction qui donne acces a des sous-maillage d'un maillage, suivant la valeur d'une entite -
[docs] def getSubMeshes(self, entity_type="geometricalEntity"): +
[docs] def getSubMeshes(self, entity_type="geometricalEntity"): """getSubMeshes(self, entity_type="geometricalEntity"): this function computes handles to sub-meshes of the given mesh and returns the @@ -259,7 +259,7 @@ return entity2subMesh
# fonction qui separe les differents maillages lus dans un meme fichier -
[docs] def separateMeshes(self, dim, entity_type="geometricalEntity", keep_all_elements=True): +
[docs] def separateMeshes(self, dim, entity_type="geometricalEntity", keep_all_elements=True): """separateMeshes(self, dim, entity_type="geometricalEntity"): this function separates several meshes, stored in a single one (read from a mesh), @@ -298,7 +298,7 @@ # pour chaque element for bulk in self.bulks: # si l'element est de la dimension condideree - if bulk.type in dimension2geoElement[dim]: + if bulk.etype in dimension2geoElement[dim]: # on recupere l'entite consideree (physique ou geometrique) de l'element courant entity=getattr(bulk, entity_type) # si l'entite n'a pas encore ete rencontree @@ -363,7 +363,7 @@ # pour chaque element for bulk in self.bulks: # si l'element courant est de dimension inferieure a celle consideree - if geoElement2dimension[bulk.type] < dim: + if geoElement2dimension[bulk.etype] < dim: # on recupere la connectivite de l'element courant connectivity=bulk.connectivity # on recupere le numero du premier noeud @@ -406,12 +406,12 @@ return entity2mesh
-
[docs] def computeNormal(self, n, e, reverse): +
[docs] def computeNormal(self, n, e, reverse): """ Compute normal of a node of an element """ - if self.bulks[e].type == 'S2xxx': + if self.bulks[e].etype == 'S2xxx': normal = np.zeros([self.dimension]) if reverse: normal[0] =-self.nodes[self.bulks[e].connectivity[0]].coor[1]+self.nodes[self.bulks[e].connectivity[1]].coor[1] @@ -419,7 +419,7 @@ else: normal[0] =-self.nodes[self.bulks[e].connectivity[1]].coor[1]+self.nodes[self.bulks[e].connectivity[0]].coor[1] normal[1] = self.nodes[self.bulks[e].connectivity[1]].coor[0]-self.nodes[self.bulks[e].connectivity[0]].coor[0] - elif self.bulks[e].type == 'T3xxx': + elif self.bulks[e].etype == 'T3xxx': if reverse: normal = np.cross( self.nodes[self.bulks[e].connectivity[1]].coor-self.nodes[self.bulks[e].connectivity[0]].coor, self.nodes[self.bulks[e].connectivity[2]].coor-self.nodes[self.bulks[e].connectivity[0]].coor @@ -442,7 +442,7 @@ return normal
-
[docs] def extrudePhysicalEntity(self, pE, length, reverse=False): +
[docs] def extrudePhysicalEntity(self, pE, length, reverse=False): """ Extrude an external layer of mesh. @@ -469,7 +469,7 @@ # list nodes and elements of the desired physical entity el_list = []; no_list = [] for e, el in enumerate(self.bulks): - if pE == el.physicalEntity and el.type in dimension2geoElement[self.dimension-1]: + if pE == el.physicalEntity and el.etype in dimension2geoElement[self.dimension-1]: el_list.append(e) for n in el.connectivity: if n not in no_list: @@ -480,7 +480,7 @@ for nod in no_list: n2b.append([]) for bul in el_list: - if nod in self.bulks[bul].connectivity and self.bulks[bul].type in extr_map.keys() : + if nod in self.bulks[bul].connectivity and self.bulks[bul].etype in extr_map.keys() : n2b[-1].append(bul) # keeps the last node number to be able to create elements @@ -496,8 +496,7 @@ n += normal[:] s += np.linalg.norm(normal) n /= s - self.addNode( node(type='NO'+str(self.dimension)+'xx', - coor=length*n+self.nodes[no].coor, + self.addNode( node(coor=length*n+self.nodes[no].coor, number=node_shift+no) ) # create new elements: @@ -511,12 +510,13 @@ new_c = new_c + [x+node_shift for x in new_c] # new extruded element - self.addBulk( element( extr_map[elem.type], new_c, + self.addBulk( element( geoElement2dimension[extr_map[elem.etype]], new_c, 'E'+elem.physicalEntity, elem.geometricalEntity) ) # the projection of the original element along the normals - self.addBulk( element( elem.type, [x+node_shift for x in elem.connectivity], + self.addBulk( element( geoElement2dimension[elem.etype], + [x+node_shift for x in elem.connectivity], 'P'+elem.physicalEntity, elem.geometricalEntity ) ) @@ -533,8 +533,8 @@ \ No newline at end of file diff --git a/docs/Pre/_modules/pylmgc90/pre_lmgc/build_avatar/mesh2D.html b/docs/Pre/_modules/pylmgc90/pre/build_avatar/mesh2D.html similarity index 86% rename from docs/Pre/_modules/pylmgc90/pre_lmgc/build_avatar/mesh2D.html rename to docs/Pre/_modules/pylmgc90/pre/build_avatar/mesh2D.html index a9b612cdb19e0906c35cc35b63f35f1908747f70..be1ddeedde8b67dc8c6ffdf263799977a102b76d 100644 --- a/docs/Pre/_modules/pylmgc90/pre_lmgc/build_avatar/mesh2D.html +++ b/docs/Pre/_modules/pylmgc90/pre/build_avatar/mesh2D.html @@ -6,7 +6,7 @@ - pylmgc90.pre_lmgc.build_avatar.mesh2D — pylmgc90.pre 2015.2 documentation + pylmgc90.pre.build_avatar.mesh2D — pylmgc90.pre 2015.2 documentation @@ -46,22 +46,22 @@
-

Source code for pylmgc90.pre_lmgc.build_avatar.mesh2D

+  

Source code for pylmgc90.pre.build_avatar.mesh2D

 # module qui fournit des macros pour construire et/ou manipuler des maillages 2D
 
 import numpy
-from pylmgc90.pre_lmgc.avatar.avatar import *
-from pylmgc90.pre_lmgc.avatar.bulk.element import *
-from pylmgc90.pre_lmgc.avatar.contactor.contactor import *
-from pylmgc90.pre_lmgc.avatar.group.group import *
-from pylmgc90.pre_lmgc.avatars import *
+from pylmgc90.pre.avatar.avatar import *
+from pylmgc90.pre.avatar.bulk.element import *
+from pylmgc90.pre.avatar.contactor.contactor import *
+from pylmgc90.pre.avatar.group.group import *
+from pylmgc90.pre.avatars import *
 from mesh import *
-from pylmgc90.pre_lmgc.utilities.error    import *
+from pylmgc90.pre.utilities.error    import *
 
 # import du module permettant de savoir si on pourra importer les pre_tools
-from pylmgc90.pre_lmgc.utilities.check_compiled_modules import *
+from pylmgc90.pre.utilities.check_compiled_modules import *
 
-from pylmgc90.pre_lmgc.avatar.contactor.contactorFactory import contactorFactory
+from pylmgc90.pre.avatar.contactor.contactorFactory import contactorFactory
 
 # si on peut essayer d'importer le module pre_tools sans tout faire planter
 if import_lmgc90():
@@ -75,7 +75,7 @@
       raise
 
 # fonction qui construit un corps deformable a partir en maillant un rectangle :
-#   - type_mesh : type de maillage :
+#   - mesh_type : type de maillage :
 #        - 'Q4' : maillage en Q4
 #        - '2T3' : maillage en T3, obtenus en coupant en deux des Q4
 #        - '4T3' : maillage en T3, obtenus en coupant en quatre des Q4
@@ -88,8 +88,8 @@
 #   - material : materiau
 #   - model : modele
 #   - number : numero du corps
-
[docs]def buildMesh2D(type_mesh, x0, y0, lx, ly, nb_elem_x, nb_elem_y, vertices=None, number=None): - '''buildMesh2D=buildMesh2D(type_mesh, x0, y0, lx, ly, nb_elem_x, nb_elem_y, vertices=None, number=None): +
[docs]def buildMesh2D(mesh_type, x0, y0, lx, ly, nb_elem_x, nb_elem_y, vertices=None, number=None): + '''buildMesh2D=buildMesh2D(mesh_type, x0, y0, lx, ly, nb_elem_x, nb_elem_y, vertices=None, number=None): this function meshes a given rectangle, and returns the generated mesh @@ -98,7 +98,7 @@ parameters: - - type_mesh: type of mesh: + - mesh_type: type of mesh: - 'Q4': mesh with elements Q4 - '2T3': mesh with elements T3, obtained by spitting one Q4 in two T3 @@ -121,7 +121,7 @@ if ( vertices ): # le maillage doit etre en Q4, partir du point (0, 0), et verifier # lx = nb_elem_x et ly = nb_elem_y - if type_mesh != 'Q4': + if mesh_type != 'Q4': showError('only a Q4 mesh accepts a list of vertices!') if x0 != 0. or y0 != 0.: showError('when list of vertices is given, (x0, y0) must be (0., 0.)!' ) @@ -130,7 +130,7 @@ # calcul du maillage, selon son type : - if type_mesh == 'Q4': # cas du maillage en Q4 + if mesh_type == 'Q4': # cas du maillage en Q4 # dimensionnement des vecteurs pour stocker le maillage [size_nodes, size_nb_node_per_ele_vol, size_conn_vol]=lmgc90.mesh2D_SizeMeshQ4(nb_elem_x, nb_elem_y) @@ -138,7 +138,7 @@ [nodes, nb_node_per_ele_vol, conn_vol]=lmgc90.mesh2D_MeshQ4(x0, y0, lx, ly, nb_elem_x, nb_elem_y, size_nodes, size_nb_node_per_ele_vol, size_conn_vol) - elif type_mesh == '2T3': # cas du maillage en T3, obtenus en coupant en deux + elif mesh_type == '2T3': # cas du maillage en T3, obtenus en coupant en deux # des Q4 [size_nodes, size_nb_node_per_ele_vol, size_conn_vol]=lmgc90.mesh2D_SizeMesh2T3(nb_elem_x, nb_elem_y) @@ -146,7 +146,7 @@ [nodes, nb_node_per_ele_vol, conn_vol]=lmgc90.mesh2D_Mesh2T3(x0, y0, lx, ly, nb_elem_x, nb_elem_y, size_nodes, size_nb_node_per_ele_vol, size_conn_vol) - elif type_mesh == '4T3': # cas du maillage en T3, obtenus en coupant en + elif mesh_type == '4T3': # cas du maillage en T3, obtenus en coupant en # quatre des Q4 [size_nodes, size_nb_node_per_ele_vol, size_conn_vol]=lmgc90.mesh2D_SizeMesh4T3(nb_elem_x, nb_elem_y) @@ -154,7 +154,7 @@ [nodes, nb_node_per_ele_vol, conn_vol]=lmgc90.mesh2D_Mesh4T3(x0, y0, lx, ly, nb_elem_x, nb_elem_y, size_nodes, size_nb_node_per_ele_vol, size_conn_vol) - elif type_mesh == 'Q8': # cas du maillage en Q8 + elif mesh_type == 'Q8': # cas du maillage en Q8 # dimensionnement des vecteurs pour stocker le maillage [size_nodes, size_nb_node_per_ele_vol, size_conn_vol]=lmgc90.mesh2D_SizeMeshQ8(nb_elem_x, nb_elem_y) @@ -176,16 +176,6 @@ beg_conn = 0 # pour chaque element for i in xrange(0, len(nb_node_per_ele_vol), 1): - # on retrouve le type de l'element en fonction de son nombre de noeuds - if nb_node_per_ele_vol[i] == 3: # cas du T3 - type = 'T3xxx' - elif nb_node_per_ele_vol[i] == 4: # cas du Q4 - type = 'Q4xxx' - elif nb_node_per_ele_vol[i] == 8: # cas du Q8 - type = 'Q8xxx' - else: # cas par defaut - # on stoppe tout - showError('unknown volumic element!') # on recupere la connectivite de l'element, sous la forme d'une liste conn=conn_vol[beg_conn:beg_conn + nb_node_per_ele_vol[i]].tolist() @@ -212,7 +202,7 @@ conn.reverse() # on ajoute l'element au maillage - surfacic_mesh.addBulk( element(type=type, connectivity=conn) ) + surfacic_mesh.addBulk( element(elem_dim=2, connectivity=conn) ) # on met a jour l'indice de debut de lecture beg_conn = beg_conn + nb_node_per_ele_vol[i] @@ -220,7 +210,7 @@ # pour chaque noeud for i in xrange(0, len(nodes)/2, 1): # on ajoute le noeud au maillage - surfacic_mesh.addNode( node(type='NO2xx', coor=nodes[2*i: 2*(i + 1)], + surfacic_mesh.addNode( node( coor=nodes[2*i: 2*(i + 1)], number=i + 1) ) # on definit la tolerance pour la recherche de l'appartenance des noeuds @@ -264,14 +254,14 @@ # pour chaque noeud de l'element for ic in xrange(0, ele.nbNodes, 1): # si l'element est un Q8 - if ele.type == 'Q8xxx' and ic >= ele.nbNodes/2: + if ele.etype == 'Q8xxx' and ic >= ele.nbNodes/2: # on laisse tomber les noeuds aux centres des lignes continue # on recupere le numero du noeud i = ele.connectivity[ic] # et le numero du noeud suivant, dans la table de connectivite de # l'element - if ele.type == 'Q8xxx': # cas particulier du Q8 + if ele.etype == 'Q8xxx': # cas particulier du Q8 # on recupere le noeud sommet suivant j = ele.connectivity[(ic + 1) % (ele.nbNodes/2)] else: # cas general @@ -317,7 +307,7 @@ [xj, yj] = nj.coor # on determine le groupe de l'element # si le maillage est en Q4 - if type_mesh == 'Q4': + if mesh_type == 'Q4': # on utilise les inidces corespondant aux noeuds # on recuepre les indices pour le noeud i @@ -354,18 +344,18 @@ # on construit le nouvel element sur la surface libre : # * cas particulier du Q8 : une ligne a trois noeuds - if ele.type == 'Q8xxx': + if ele.etype == 'Q8xxx': # on recupere le numero nu noeud au centre de l'arete k = ele.connectivity[(ic + (ele.nbNodes/2)) % ele.nbNodes] # ATTENTION: on conserve le sens trigonometrique de la # description de la connectivite des Q8, pour definir la # ligne a trois noeuds - surf = element(type='S3xxx', connectivity=[i, k, j], physicalEntity=pE) + surf = element(elem_dim=1, connectivity=[i, k, j], physicalEntity=pE) # * cas general : une ligne a deux noeuds else: # ATTENTION : la connectivite d'une ligne supportant un # contacteur est definie dans le sens anti-trigonometrique - surf = element(type='S2xxx', connectivity=[j, i], physicalEntity=pE) + surf = element(elem_dim=1, connectivity=[j, i], physicalEntity=pE) # on ajoute l'element au maillage surfacic_mesh.addBulk(surf) @@ -374,7 +364,7 @@ return surfacic_mesh
# fonction qui eclate un objet maille -
[docs]def explodeMeshedAvatar2D(body, nbPoints=2, color='BLEUx', w=None): +
[docs]def explodeMeshedAvatar2D(body, nbPoints=2, color='BLEUx', w=None, color_dict=None): '''bodies=explodeMeshedAvatar2D(body, nbPoints=2, color='BLEUx', w=None): this function "explodes" a given 2D meshed avatar, i.e. gets a meshed avatar and returns a @@ -388,14 +378,15 @@ optional parameters: - nbPoints: number of points on the contactors candidate - - color: color of the contactors + - color: default color of the contactors - w: vector of CLxxx positions + - color_dict: a dictionnary associating a color to the physical entity of the element ''' # on verifie que l'objet est bien un maillage : if not isinstance(body, avatar): showError('this object is not a body!') - if body.type != 'MAILx': + if body.atype != 'MAILx': showError('this body is not a MAILx!') # on verifie sa dimension @@ -404,7 +395,7 @@ # on verifie que l'objet soit maille avec des elements d'ordre 1 for ele in body.bulks: - if ele.type == 'Q8xxx' or ele.type == 'T6xxx': + if ele.etype == 'Q8xxx' or ele.etype == 'T6xxx': showError('this function is designed for linear elements!') # on definit une liste d'avatar, qui va contenir la liste des elements @@ -419,13 +410,16 @@ # qui lui correspond body2eleIndex={} + if not color_dict: + color_dict = {} + # on cree un corps pour chaque element fini bodyIndex=0 # pour chaque element fini for ele in body.bulks: # si l'element n'est pas un element de surface - if not ele.type in dimension2geoElement[2]: + if not ele.etype in dimension2geoElement[2]: # on saute l'element continue @@ -438,13 +432,13 @@ bodyIndex += 1 # on cree un nouveau corps maille 2D - new_body = avatar(type='MAILx', dimension=2) - # on ajoute au nouveau corps un nouvel element fini, du meme type que + new_body = avatar(dimension=2) + # on ajoute au nouveau corps un nouvel element fini, du meme type que # l'element courant mais dont la connectivite est triviale # N.B.: on conserve la physical entity, i.e. le groupe de l'element - new_body.addBulk( element(type=ele.type, - connectivity=range(1, ele.nbNodes + 1, 1), - physicalEntity=ele.physicalEntity) ) + new_body.addBulk( element(elem_dim=geoElement2dimension[ele.etype], + connectivity=range(1, ele.nbNodes + 1, 1), + physicalEntity=ele.physicalEntity) ) # on ajoute au corps les seuls noeuds dont il a besoin @@ -458,7 +452,7 @@ n = body.nodes[i] # on peut alors construire le nouveau noeud, connaissant ses # coordonnees - new_body.addNode( node(type='NO2xx', coor=n.coor, number=nbNodes) ) + new_body.addNode( node( coor=n.coor, number=nbNodes) ) # on ajoute le corps genere au container bodies += new_body @@ -474,7 +468,7 @@ # pour chaque element du maillage for ele in body.bulks: # si l'element n'est pas un element de surface - if not ele.type in dimension2geoElement[2]: + if not ele.etype in dimension2geoElement[2]: # on saute l'element continue # pour chaque noeud de l'element @@ -492,7 +486,7 @@ for ele in body.bulks: # si l'element n'est pas un element de surface - if not ele.type in dimension2geoElement[2]: + if not ele.etype in dimension2geoElement[2]: # on saute l'element continue @@ -544,9 +538,14 @@ # a deux noeuds # ATTENTION : la connectivite d'une ligne supportant un contacteur # est definie dans le sens anti-trigonometrique - surf = element(type='S2xxx', connectivity=[(ic + 1) % ele.nbNodes + 1, ic + 1]) + surf = element(elem_dim=1, connectivity=[(ic + 1) % ele.nbNodes + 1, ic + 1]) # on positionne un contacteur sur l'element courant, en fonction # de son numero + try: + col = color_dict[ele.physicalEntity] + except KeyError: + col = color + if ele.number > found_ele.number: # si son numero est plus grand que celui de l'element adjacent # il porte des noeuds candidats @@ -565,8 +564,7 @@ # on calcule le poids associe au point courant weights[i]=(0.5 + i)/nbPoints # on cree un contacteur candidat - cd = contactorFactory(elements=[surf], type='CLxxx', color=color, - weights=weights) + cd = contactorFactory(elements=[surf], shape='CLxxx', color=col, weights=weights) # on l'ajoute au nouveau corps corespondant a l'element # courant # N.B.: on utilise ici une methode privee de la classe avatar @@ -578,7 +576,7 @@ # sinon, il porte une ligne antagoniste # on cree un contacteur antagoniste - an = contactorFactory(elements=[surf], type='ALpxx', color=color) + an = contactorFactory(elements=[surf], shape='ALpxx', color=col) # on l'ajoute au nouveau corps corespondant a l'element # courant # N.B.: on utilise ici une methode privee de la classe avatar @@ -597,7 +595,7 @@ # pour chaque element for ele_surf in body.bulks: # si l'element n'est pas une ligne - if ele_surf.type != 'S2xxx': + if ele_surf.etype != 'S2xxx': # on passe au suivant continue # si la connectivite correspond @@ -612,9 +610,9 @@ # on cree l'element ligne a ajouter au corps # ATTENTION : la connectivite d'une ligne supportant un # contacteur est definie dans le sens anti-trigonometrique - surf = element(type='S2xxx', - connectivity=[(ic + 1) % ele.nbNodes + 1, ic + 1], - physicalEntity=found_line.physicalEntity) + surf = element(elem_dim=1, + connectivity=[(ic + 1) % ele.nbNodes + 1, ic + 1], + physicalEntity=found_line.physicalEntity) # on l'ajoute au nouveau corps new_body.addBulk(surf) @@ -636,7 +634,7 @@ return bodies
# fonction qui prend un maillage 2D et l'eclate en rigides (polygones) -
[docs]def rigidsFromMesh2D(surfacic_mesh, model, material, color='BLEUx', reverse=False, shrink=0.): +
[docs]def rigidsFromMesh2D(surfacic_mesh, model, material, color='BLEUx', reverse=False, shrink=0.): """rigidsFromMesh2D(surfacic_mesh, model, material, color='BLEUx', reverse=False, shrink=0.): this function build a set of rigids from a 2D mesh, each rigid @@ -670,16 +668,16 @@ # pour chaque element du maillage for bulk in surfacic_mesh.bulks: # si l'element n'est pas un triangle a 3 noeuds ou un quadrangle a quatre noeuds - if bulk.type != 'T3xxx' and bulk.type != 'Q4xxx': + if bulk.etype != 'T3xxx' and bulk.etype != 'Q4xxx': # on passe au suivant continue # on cree un avatar pour le nouveau rigide - body=avatar(type='RBDY2', dimension=2) + body=avatar(dimension=2) # on cree un comportement volumique de type rigide body.addBulk( rigid2d() ) # on place le centre d'inertie a l'origine (recalcul de la position par la suite) - body.addNode( node(type='NO2xx', coor=numpy.zeros(2), number=1) ) + body.addNode( node( coor=numpy.zeros(2), number=1) ) # on definit les groupes sur le corps body.defineGroups() # on affecte son modele au corps @@ -724,7 +722,7 @@ # on inverse la liste des coordonnees des noeuds de l'element l_coor.reverse() # on ajoute son contacteur polygone au corps - body.addContactors(type='POLYG', color=color, nb_vertices=len(l_coor), vertices=numpy.array(l_coor)) + body.addContactors(shape='POLYG', color=color, nb_vertices=len(l_coor), vertices=numpy.array(l_coor)) # on calcule de la surface et de l'inertie du corps body.computeRigidProperties() @@ -736,7 +734,7 @@ return bodies
# fonction qui prend un maillage 2D et cree un corps rigide comme un cluster de polygones (chaque maille devenant un contacteur) -
[docs]def rigidFromMesh2D(surfacic_mesh, model, material, color='BLEUx', reverse=False): +
[docs]def rigidFromMesh2D(surfacic_mesh, model, material, color='BLEUx', reverse=False): """rigidFromMesh2D(surfacic_mesh, model, material, color='BLEUx', reverse=False): this function build a rigid from a 2D mesh, each contactor @@ -764,11 +762,11 @@ showError("the given mesh is not a surfacic mesh") # on cree un avatar pour le nouveau rigide - body=avatar(type='RBDY2', dimension=2) + body=avatar(dimension=2) # on cree un comportement volumique de type rigide body.addBulk( rigid2d() ) # on place le centre d'inertie a l'origine (recalcul de la position par la suite) - body.addNode( node(type='NO2xx', coor=numpy.zeros(2), number=1) ) + body.addNode( node( coor=numpy.zeros(2), number=1) ) # on definit les groupes sur le corps body.defineGroups() # on affecte son modele au corps @@ -779,7 +777,7 @@ # pour chaque element du maillage for bulk in surfacic_mesh.bulks: # si l'element n'est pas un triangle a 3 noeuds ou un quadrangle a quatre noeuds - if bulk.type != 'T3xxx' and bulk.type != 'Q4xxx': + if bulk.etype != 'T3xxx' and bulk.etype != 'Q4xxx': # on passe au suivant continue @@ -796,7 +794,7 @@ # on inverse la liste des coordonnees des noeuds de l'element l_coor.reverse() # on ajoute son contacteur polygone au corps - body.addContactors(type='POLYG', color=color, nb_vertices=len(l_coor), vertices=numpy.array(l_coor)) + body.addContactors(shape='POLYG', color=color, nb_vertices=len(l_coor), vertices=numpy.array(l_coor)) # on calcule de la surface et de l'inertie du corps body.computeRigidProperties() @@ -865,9 +863,9 @@ # pour chaque element for bulk in given_mesh.bulks: # si l'element est un element surfacique - if bulk.type in dimension2geoElement[2]: + if bulk.etype in dimension2geoElement[2]: # si l'element est un triangle - if bulk.type == 'T3xxx': # ca pourrait etre T6xxx aussi ... + if bulk.etype == 'T3xxx': # ca pourrait etre T6xxx aussi ... # on suppose que tous les bords sont sur le contour is_free_face[bulk.number]=[True, True, True] @@ -889,7 +887,7 @@ continue # si l'element courant n'est pas un element surfacique - if not adj_bulk.type in dimension2geoElement[2]: + if not adj_bulk.etype in dimension2geoElement[2]: # on passe au suivant continue @@ -915,7 +913,7 @@ # on passe au suivant continue # si l'element courant n'est pas un element surfacique - if not adj_bulk.type in dimension2geoElement[2]: + if not adj_bulk.etype in dimension2geoElement[2]: # on passe au suivant continue @@ -926,7 +924,7 @@ # on incremente le nombre de bords de l'ele qui n'appartiennent pas au contour nb_non_free_faces[bulk.number] += 1 - elif bulk.type == 'Q4xxx': + elif bulk.etype == 'Q4xxx': # on suppose que tous les bords sont sur le contour is_free_face[bulk.number]=[True]*4 @@ -944,7 +942,7 @@ continue # si l'element courant n'est pas un element surfacique - if not adj_bulk.type in dimension2geoElement[2] : + if not adj_bulk.etype in dimension2geoElement[2] : continue # si le bord 0 {i1, i2} fait partie de l'adjacent @@ -969,7 +967,7 @@ continue # si l'element courant n'est pas un tetraedre - if not adj_bulk.type in dimension2geoElement[2]: + if not adj_bulk.etype in dimension2geoElement[2]: # on passe au suivant continue @@ -991,7 +989,7 @@ else: ## on quitte le pgm msg = "no contour can be built from this mesh, since it involves unhandled elements!" - msg += bulk.type + ' is not supported' + msg += bulk.etype + ' is not supported' showError(msg) # ici, on est sur que tous les elements du maillage sont pris en charge @@ -1006,16 +1004,16 @@ # pour chaque element for bulk in given_mesh.bulks: # si element surfacique - if bulk.type in dimension2geoElement[2]: + if bulk.etype in dimension2geoElement[2]: ###print nb_non_free_faces[bulk.number] # si l'element est un tetraedre - if bulk.type == 'T3xxx': + if bulk.etype == 'T3xxx': nbn=3 # 0->2 # si aucun bord libre if nb_non_free_faces[bulk.number] == 3: # on passe a l'element suivant continue - elif bulk.type == 'Q4xxx': + elif bulk.etype == 'Q4xxx': nbn=4 # 0->3 # si aucun bord libre if nb_non_free_faces[bulk.number] == 4: @@ -1029,11 +1027,11 @@ for i in xrange(0, len(is_free_face[bulk.number])): # si la face courante est libre if is_free_face[bulk.number][i]: - ###print bulk.number,bulk.type,nbn,' bord ',i,(i+1)%nbn + ###print bulk.number,bulk.etype,nbn,' bord ',i,(i+1)%nbn # on recupere la connectivite de la face bord=[ bulk.connectivity[i] , bulk.connectivity[(i+1)%nbn]] # on ajoute le bord au contour - contour.addBulk( element(type='S2xxx', connectivity=bord) ) + contour.addBulk( element(elem_dim=1, connectivity=bord) ) # recuperation des noeuds du contour @@ -1064,8 +1062,8 @@ \ No newline at end of file diff --git a/docs/Pre/_modules/pylmgc90/pre_lmgc/build_avatar/mesh3D.html b/docs/Pre/_modules/pylmgc90/pre/build_avatar/mesh3D.html similarity index 90% rename from docs/Pre/_modules/pylmgc90/pre_lmgc/build_avatar/mesh3D.html rename to docs/Pre/_modules/pylmgc90/pre/build_avatar/mesh3D.html index e0ef280929857d6281288173b65cfae6a2566bec..062603233a5b8c4e859e2e4404781aeb538e3dc1 100644 --- a/docs/Pre/_modules/pylmgc90/pre_lmgc/build_avatar/mesh3D.html +++ b/docs/Pre/_modules/pylmgc90/pre/build_avatar/mesh3D.html @@ -6,7 +6,7 @@ - pylmgc90.pre_lmgc.build_avatar.mesh3D — pylmgc90.pre 2015.2 documentation + pylmgc90.pre.build_avatar.mesh3D — pylmgc90.pre 2015.2 documentation @@ -46,22 +46,22 @@
-

Source code for pylmgc90.pre_lmgc.build_avatar.mesh3D

+  

Source code for pylmgc90.pre.build_avatar.mesh3D

 # module qui fournit des macros pour construire et/ou manipuler des maillages 3D
 
 import sys
 import numpy
 import math
 import copy
-from pylmgc90.pre_lmgc.avatar.avatar import *
-from pylmgc90.pre_lmgc.avatar.bulk.element import *
-from pylmgc90.pre_lmgc.avatar.bulk.rigid3d import *
-from pylmgc90.pre_lmgc.avatar.contactor.rigid_properties_3D import computeVolumeInertiaMesh
+from pylmgc90.pre.avatar.avatar import *
+from pylmgc90.pre.avatar.bulk.element import *
+from pylmgc90.pre.avatar.bulk.rigid3d import *
+from pylmgc90.pre.avatar.contactor.rigid_properties_3D import computeVolumeInertiaMesh
 from mesh import *
-from pylmgc90.pre_lmgc.utilities.error    import *
+from pylmgc90.pre.utilities.error    import *
 
 # import du module permettant de savoir si on pourra importer les pre_tools
-from pylmgc90.pre_lmgc.utilities.check_compiled_modules import *
+from pylmgc90.pre.utilities.check_compiled_modules import *
 
 
 # si on peut essayer d'importer le module pre_tools sans tout faire planter
@@ -98,7 +98,7 @@
 
 # fonction qui extrait la surface libre d'un maillage 3D volumique, sous la forme d'un maillage 3D surfacique
 # N.B.: les numeros des noeuds du maillage surfacique ne sont pas renumerotes
-
[docs]def extractFreeSurface(volumic_mesh): +
[docs]def extractFreeSurface(volumic_mesh): """extractFreeSurface(volumic_mesh): this function computes and returns the free surface of a volumic mesh, as a @@ -155,9 +155,9 @@ # pour chaque element for bulk in volumic_mesh.bulks: # si l'element est un element volumique - if bulk.type in dimension2geoElement[3]: + if bulk.etype in dimension2geoElement[3]: # si l'element est un tetraedre - if bulk.type == 'TE4xx': + if bulk.etype == 'TE4xx': # on suppose que les quatre faces du tetraedre sont sur la surface libre is_free_face[bulk.number]=[True, True, True, True] # on recupere les numeros des noeuds du tetraedre @@ -175,7 +175,7 @@ # on passe au suivant continue # si l'element courant n'est pas un tetraedre - if adj_bulk.type != 'TE4xx': + if adj_bulk.etype != 'TE4xx': # on passe au suivant continue @@ -207,7 +207,7 @@ # on passe au suivant continue # si l'element courant n'est pas un tetraedre - if adj_bulk.type != 'TE4xx': + if adj_bulk.etype != 'TE4xx': # on passe au suivant continue # si la face {i4, i2, i3} fait partie du tetraedre adjacent courant @@ -217,7 +217,7 @@ # on incremente le nombre de faces du tetraedre courant qui n'appartiennent pas a la surface libre nb_non_free_faces[bulk.number] += 1 - elif bulk.type == 'PRI6x': + elif bulk.etype == 'PRI6x': # on suppose que les faces sont sur la surface libre (ce commentaire est reellement debile) # par contre on ne test qu'avec d'autres pri6 !! @@ -245,7 +245,7 @@ continue # on ne test qu'avec des PRI6 ... a modifier. - if adj_bulk.type != 'PRI6x': + if adj_bulk.etype != 'PRI6x': continue # si la face {i1, i2, i5, i4} fait partie de l'adjacent if i2 in adj_bulk.connectivity and i5 in adj_bulk.connectivity and i4 in adj_bulk.connectivity: @@ -273,7 +273,7 @@ # on passe au suivant continue # si l'element courant n'est pas un tetraedre - if adj_bulk.type != 'PRI6x': + if adj_bulk.etype != 'PRI6x': # on passe au suivant continue # si la face {i4, i5, i6} fait partie de l'adjacent @@ -293,7 +293,7 @@ else: ## on quitte le pgm msg = "no rigid can be built from this mesh, since it involves unhandled elements!" - msg += bulk.type + ' is not supported' + msg += bulk.etype + ' is not supported' showError(msg) # ici, on est sur que tous les elements volumiques du maillage sont pris en charge @@ -311,9 +311,9 @@ # pour chaque element for bulk in volumic_mesh.bulks: # si l'element est un element volumique - if bulk.type in dimension2geoElement[3]: + if bulk.etype in dimension2geoElement[3]: # si l'element est un tetraedre - if bulk.type == 'TE4xx': + if bulk.etype == 'TE4xx': # si aucune face du tetraedre appartient a la surface libre if nb_non_free_faces[bulk.number] == 4: # on passe a l'element suivant @@ -327,8 +327,8 @@ bulk.connectivity[faces_tetra[i][1]], bulk.connectivity[faces_tetra[i][2]] ] # on ajoute la face a la liste des faces de la surface libre - free_surface.addBulk( element(type='T3xxx', connectivity=conn_free_face) ) - elif bulk.type == 'PRI6x': + free_surface.addBulk( element(elem_dim=2, connectivity=conn_free_face) ) + elif bulk.etype == 'PRI6x': # si aucune face du tetraedre appartient a la surface libre if nb_non_free_faces[bulk.number] == 6: # on passe a l'element suivant @@ -343,7 +343,7 @@ bulk.connectivity[faces_pri[i][1]], bulk.connectivity[faces_pri[i][2]] ] # on ajoute la face a la liste des faces de la surface libre - free_surface.addBulk( element(type='T3xxx', connectivity=conn_free_face) ) + free_surface.addBulk( element(elem_dim=2, connectivity=conn_free_face) ) else: #print i @@ -355,7 +355,7 @@ bulk.connectivity[faces_pri[i][2]], bulk.connectivity[faces_pri[i][3]] ] # on ajoute la face a la liste des faces de la surface libre - free_surface.addBulk( element(type='Q4xxx', connectivity=conn_free_face) ) + free_surface.addBulk( element(elem_dim=2, connectivity=conn_free_face) ) # recuperation des noeuds de la surface libre @@ -376,7 +376,7 @@ return free_surface
# fonction qui reoriente les elements surfacique d'un maillage 3D, en se servant de l'orientation des elements volumiques -
[docs]def reorientSurfacicElements(volumic_mesh): +
[docs]def reorientSurfacicElements(volumic_mesh): """reorientSurfacicElements(volumic_mesh): this function reorient surfacic elements of a 3D mesh, using orientation of volumic elements @@ -422,7 +422,7 @@ # pour chaque element du maillage for bulk in volumic_mesh.bulks: # si l'element est un element surfacique - if bulk.type in dimension2geoElement[2]: + if bulk.etype in dimension2geoElement[2]: # on recupere la connectivite de l'element courant connectivity=bulk.connectivity @@ -456,7 +456,7 @@ # fonction qui construit un corps rigide a partir d'un maillage 3D, decrit comme un ensemble de noeuds et # un ensemble d'elements -
[docs]def volumicMeshToRigid3D(volumic_mesh, model, material, color='BLEUx'): +
[docs]def volumicMeshToRigid3D(volumic_mesh, model, material, color='BLEUx'): """volumicMeshToRigid3D(volumic_mesh, model, material, color='BLEUx'): this function builds a rigid body from a volumic mesh, by extracting the skin mesh and compute mass and inertia @@ -494,7 +494,7 @@ # pour chaque element for ele in volumic_mesh.bulks: # si l'element est un element volumique - if ele.type in dimension2geoElement[3]: + if ele.etype in dimension2geoElement[3]: # on incremente le nombre d'elements volumiques nb_volumic_bulks += 1 @@ -508,10 +508,10 @@ # # on declare le nouvel avatar - body=avatar(type='RBDY3', dimension=3) + body=avatar(dimension=3) # on positionne le centre d'inertie du rigide a l'origine, pour pouvoir # donner les coordonnees des sommets du polyedre dans le repere global - body.addNode( node(type='NO3xx', coor=numpy.zeros(3), number=1) ) + body.addNode( node( coor=numpy.zeros(3), number=1) ) # on cree un comportement volumique pour le corps body.addBulk( rigid3d() ) # on definit les groupes pour l'avatar @@ -546,7 +546,7 @@ volume, I, OG=computeVolumeInertiaMesh(volumic_mesh) # on ajoute son contacteur polyedre a l'avatar - body.addContactors(type='POLYR', color=color, volume=volume, I=I, shift=OG, + body.addContactors(shape='POLYR', color=color, volume=volume, I=I, shift=OG, nb_vertices=len(l_free_coor), nb_faces=len(l_free_conn), vertices=numpy.array(l_free_coor), connectivity=numpy.array(l_free_conn)) @@ -595,15 +595,15 @@ # pour chaque element for i, ele in enumerate(surfacic_mesh.bulks): # si l'element est un element volumique - if ele.type in dimension2geoElement[3]: + if ele.etype in dimension2geoElement[3]: # on affiche un message d'erreur showError("the given mesh is not a surfacic mesh") # sinon, si l'element est un point ou une ligne - if not ele.type in dimension2geoElement[2]: + if not ele.etype in dimension2geoElement[2]: # on passe au suivant continue # si l'element courant est un element surfacique, mais n'est pas un triangle a trois noeuds - if ele.type != 'T3xxx': + if ele.etype != 'T3xxx': # on affiche un message d'erreur showError("the given surfacic mesh contains unhandled elements!") # sinon, @@ -649,7 +649,7 @@ # pour chaque element for ele in surfacic_mesh.bulks: # si l'element courant est un triangle - if ele.type == 'T3xxx': + if ele.etype == 'T3xxx': # on stocke sa connectivite connec[3*i:3*(i + 1)]=ele.connectivity # on incremente l'indice de l'element triangle courant @@ -665,7 +665,7 @@ # fonction qui construit un corps rigide a partir d'un maillage de surface 3D, decrit comme un ensemble de noeuds et # un ensemble d'elements -
[docs]def surfacicMeshToRigid3D(surfacic_mesh, model, material, color='BLEUx'): +
[docs]def surfacicMeshToRigid3D(surfacic_mesh, model, material, color='BLEUx'): """surfacicMeshToRigid3D(surfacic_mesh, model, material, color='BLEUx'): this function builds a rigid body from a surfacic mesh, by computing mass and inertia @@ -703,15 +703,15 @@ # pour chaque element for ele in surfacic_mesh.bulks: # si l'element est un element volumique - if ele.type in dimension2geoElement[3]: + if ele.etype in dimension2geoElement[3]: # on affiche un message d'erreur showError("the given mesh is not a surfacic mesh") # sinon, si l'element est un point ou une ligne - if not ele.type in dimension2geoElement[2]: + if not ele.etype in dimension2geoElement[2]: # on passe au suivant continue # si l'element courant est un element surfacique, mais n'est pas un triangle a trois noeuds - if ele.type != 'T3xxx': + if ele.etype != 'T3xxx': # on affiche un message d'erreur showError("the given surfacic mesh contains unhandled elements!") # sinon, @@ -732,10 +732,10 @@ # # on declare le nouvel avatar - body=avatar(type='RBDY3', dimension=3) + body=avatar(dimension=3) # on positionne le centre d'inertie du rigide a l'origine, pour pouvoir # donner les coordonnees des sommets du polyedre dans le repere global - body.addNode( node(type='NO3xx', coor=numpy.zeros(3), number=1) ) + body.addNode( node( coor=numpy.zeros(3), number=1) ) # on cree un comportement volumique pour le corps body.addBulk( rigid3d() ) # on definit les groupes pour l'avatar @@ -771,7 +771,7 @@ # pour chaque element for ele in surfacic_mesh.bulks: # si l'element courant est un triangle - if ele.type == 'T3xxx': + if ele.etype == 'T3xxx': # on stocke sa connectivite connec[3*i:3*(i + 1)]=ele.connectivity # on incremente l'indice de l'element triangle courant @@ -789,7 +789,7 @@ connec=connec.T.reshape([nb_bulks_T3, 3]) # on ajoute son contacteur polyedre a l'avatar - body.addContactors(type='POLYR', color=color, volume=volume, I=I, shift=OG, + body.addContactors(shape='POLYR', color=color, volume=volume, I=I, shift=OG, nb_vertices=nb_nodes, nb_faces=nb_bulks_T3, vertices=coor, connectivity=connec) # calcul du volume et de l'inertie du corps (a partir du volume et de l'inertie @@ -801,7 +801,7 @@ # fonction qui construit un corps rigide a partir d'un ensemble de surface 3D, # decrit comme un ensemble de noeuds et un ensemble d'elements -
[docs]def surfacicMeshesToRigid3D(surfacic_meshes, model, material, color='BLEUx',reverse='no'): +
[docs]def surfacicMeshesToRigid3D(surfacic_meshes, model, material, color='BLEUx',reverse='no'): """surfacicMeshesToRigid3D(surfacic_meshes, model, material, color='BLEUx'): this function builds a rigid body from a list of surfacic mesh, by computing mass and inertia @@ -823,10 +823,10 @@ """ # on declare le nouvel avatar - body=avatar(type='RBDY3', dimension=3) + body=avatar(dimension=3) # on positionne le centre d'inertie du rigide a l'origine, pour pouvoir # donner les coordonnees des sommets du polyedre dans le repere global - body.addNode( node(type='NO3xx', coor=numpy.zeros(3), number=1) ) + body.addNode( node( coor=numpy.zeros(3), number=1) ) # on cree un comportement volumique pour le corps body.addBulk( rigid3d() ) # on definit les groupes pour l'avatar @@ -866,15 +866,15 @@ # pour chaque element for ele in surfacic_mesh.bulks: # si l'element est un element volumique - if ele.type in dimension2geoElement[3]: + if ele.etype in dimension2geoElement[3]: # on affiche un message d'erreur showError("the given mesh is not a surfacic mesh") # sinon, si l'element est un point ou une ligne - if not ele.type in dimension2geoElement[2]: + if not ele.etype in dimension2geoElement[2]: # on passe au suivant continue # si l'element courant est un element surfacique, mais n'est pas un triangle a trois noeuds - if ele.type != 'T3xxx': + if ele.etype != 'T3xxx': # on affiche un message d'erreur showError("the given surfacic mesh contains unhandled elements!") # sinon, @@ -919,7 +919,7 @@ # pour chaque element for ele in surfacic_mesh.bulks: # si l'element courant est un triangle - if ele.type == 'T3xxx': + if ele.etype == 'T3xxx': #print 'ajout de l element ',nb_elements+i,' : ', [x+nb_nodes for x in ele.connectivity] # on stocke sa connectivite connec[3*(nb_elements+i):3*(nb_elements+i+1)]=ele.connectivity @@ -942,7 +942,7 @@ #print I # on ajoute son contacteur polyedre a l'avatar - body.addContactors(type='POLYF', color=color, volume=volume, I=I, shift=OG, + body.addContactors(shape='POLYF', color=color, volume=volume, I=I, shift=OG, nb_patch=len(surfacic_meshes), patch=surfacic_meshes) # calcul du volume et de l'inertie du corps (a partir du volume et de l'inertie @@ -953,7 +953,7 @@ return body
# fonction qui consrtuit le maillage en hexaedres d'un paralepipede rectangle -
[docs]def buildMeshH8(x0, y0, z0, lx, ly, lz, nb_elem_x, nb_elem_y, nb_elem_z, surfacic_mesh_type='Q4'): +
[docs]def buildMeshH8(x0, y0, z0, lx, ly, lz, nb_elem_x, nb_elem_y, nb_elem_z, surfacic_mesh_type='Q4'): """buildMeshH8(x0, y0, z0, lx, ly, lz, nb_elem_x, nb_elem_y, nb_elem_z): this function meshes a given box, and returns the generated mesh @@ -1010,7 +1010,7 @@ # on calcule les coordonnees du noeud courant coor = numpy.array([x0 + i*delta_x, y0 + j*delta_y, z0 + k*delta_z]) # on ajoute le noeud courant au maillage - volumic_mesh.addNode( node(type='NO3xx', coor=coor, number=num) ) + volumic_mesh.addNode( node( coor=coor, number=num) ) # calcul des connectivites des elements volumiques @@ -1024,7 +1024,7 @@ connectivity=[index(i, j, k), index(i + 1, j, k), index(i + 1, j + 1, k), index(i, j + 1, k), index(i, j, k + 1), index(i + 1, j, k + 1), index(i + 1, j + 1, k + 1), index(i, j + 1, k + 1)] # on ajoute l'element courant au maillage - volumic_mesh.addBulk( element(type='H8xxx', connectivity=connectivity) ) + volumic_mesh.addBulk( element(elem_dim=3, connectivity=connectivity) ) # calcul des connectivites des elements surfaciques @@ -1037,7 +1037,7 @@ # on construit la connectivite de l'element courant connectivity=[index(i, j, k), index(i, j + 1, k), index(i + 1, j + 1, k), index(i + 1, j, k)] # on ajoute l'element courant au maillage - volumic_mesh.addBulk( element(type='Q4xxx', connectivity=connectivity, physicalEntity='down') ) + volumic_mesh.addBulk( element(elem_dim=2, connectivity=connectivity, physicalEntity='down') ) # * face du dessus (i.e. z=z0 + lz) k = nb_elem_z - 1 @@ -1048,7 +1048,7 @@ # on construit la connectivite de l'element courant connectivity=[index(i, j, k + 1), index(i + 1, j, k + 1), index(i + 1, j + 1, k + 1), index(i, j + 1, k + 1)] # on ajoute l'element courant au maillage - volumic_mesh.addBulk( element(type='Q4xxx', connectivity=connectivity, physicalEntity='up') ) + volumic_mesh.addBulk( element(elem_dim=2, connectivity=connectivity, physicalEntity='up') ) # * face de gauche (i.e. y=y0) j = 0 @@ -1059,7 +1059,7 @@ # on construit la connectivite de l'element courant connectivity=[index(i, j, k), index(i + 1, j, k), index(i + 1, j, k + 1), index(i, j, k + 1)] # on ajoute l'element courant au maillage - volumic_mesh.addBulk( element(type='Q4xxx', connectivity=connectivity, physicalEntity='left') ) + volumic_mesh.addBulk( element(elem_dim=2, connectivity=connectivity, physicalEntity='left') ) # * face de droite (i.e. y=y0 + ly) j = nb_elem_y - 1 @@ -1070,7 +1070,7 @@ # on construit la connectivite de l'element courant connectivity=[index(i + 1, j + 1, k), index(i, j + 1, k), index(i, j + 1, k + 1), index(i + 1, j + 1, k + 1)] # on ajoute l'element courant au maillage - volumic_mesh.addBulk( element(type='Q4xxx', connectivity=connectivity, physicalEntity='right') ) + volumic_mesh.addBulk( element(elem_dim=2, connectivity=connectivity, physicalEntity='right') ) # * face de derriere (i.e. x=x0) i = 0 @@ -1081,7 +1081,7 @@ # on construit la connectivite de l'element courant connectivity=[index(i, j, k), index(i, j, k + 1), index(i, j + 1, k + 1), index(i, j + 1, k)] # on ajoute l'element courant au maillage - volumic_mesh.addBulk( element(type='Q4xxx', connectivity=connectivity, physicalEntity='rear') ) + volumic_mesh.addBulk( element(elem_dim=2, connectivity=connectivity, physicalEntity='rear') ) # * face de devant (i.e. x=x0 + lx) i = nb_elem_x - 1 @@ -1092,7 +1092,7 @@ # on construit la connectivite de l'element courant connectivity=[index(i + 1, j, k), index(i + 1, j + 1, k), index(i + 1, j + 1, k + 1), index(i + 1, j, k + 1)] # on ajoute l'element courant au maillage - volumic_mesh.addBulk( element(type='Q4xxx', connectivity=connectivity, physicalEntity='front') ) + volumic_mesh.addBulk( element(elem_dim=2, connectivity=connectivity, physicalEntity='front') ) # si l'utilisateur a demande autre chose que le maillage surfacique en Q4 classique if surfacic_mesh_type != "Q4": @@ -1103,7 +1103,7 @@ # on recupere l'element courant ele=volumic_mesh.bulks[i_ele] # si l'element n'est pas un Q4 - if ele.type != 'Q4xxx': + if ele.etype != 'Q4xxx': # on passe au suivant continue @@ -1118,12 +1118,12 @@ # on construit la connectivite du premier element connectivity_1=[connectivity_Q4[0], connectivity_Q4[1], connectivity_Q4[3]] # on cree le premier element - ele_T3_1=element(type='T3xxx', connectivity=connectivity_1, physicalEntity=physicalEntity_Q4) + ele_T3_1=element(elem_dim=2, connectivity=connectivity_1, physicalEntity=physicalEntity_Q4) # * deuxieme element : # on construit la connectivite du deuxieme element connectivity_2=[connectivity_Q4[2], connectivity_Q4[3], connectivity_Q4[1]] # on cree le deuxieme element - ele_T3_2=element(type='T3xxx', connectivity=connectivity_2, physicalEntity=physicalEntity_Q4) + ele_T3_2=element(elem_dim=2, connectivity=connectivity_2, physicalEntity=physicalEntity_Q4) # on remplace l'element courant par le premier T3 ele_T3_1.number=i_ele @@ -1203,7 +1203,7 @@ # on calcule les coordonnees du noeud courant coor = numpy.array([x0 + i*ddx, y0 + j*ddy, z0 + k*ddz]) # on ajoute le noeud courant au maillage - volumic_mesh.addNode( node(type='NO3xx', coor=coor, number=num) ) + volumic_mesh.addNode( node( coor=coor, number=num) ) # calcul des connectivites des elements volumiques @@ -1221,7 +1221,7 @@ index(i, j, k ,0,0,1), index(i+1, j, k ,0,0,1), index(i+1, j+1, k ,0,0,1), index(i, j+1, k ,0,0,1) ] # on ajoute l'element courant au maillage - volumic_mesh.addBulk( element(type='H20xx', connectivity=connectivity) ) + volumic_mesh.addBulk( element(elem_dim=3, connectivity=connectivity) ) # copy past from above... @@ -1232,7 +1232,7 @@ for i in range(0, nb_elem_x): connectivity=[index(i,j,k), index(i,j+1,k), index(i+1,j+1,k), index(i+1,j,k), index(i,j,k,0,1,0), index(i,j+1,k,1,0,0), index(i+1,j,k,0,1,0), index(i,j,k,1,0,0)] - volumic_mesh.addBulk( element(type='Q8xxx', connectivity=connectivity, physicalEntity='down') ) + volumic_mesh.addBulk( element(elem_dim=2, connectivity=connectivity, physicalEntity='down') ) # up (i.e. z=z0 + lz) k = nb_elem_z - 1 @@ -1240,7 +1240,7 @@ for i in range(0, nb_elem_x): connectivity=[index(i,j,k+1), index(i+1,j,k+1), index(i+1,j+1,k+1), index(i,j+1,k+1), index(i,j,k+1,1,0,0), index(i+1,j,k+1,0,1,0), index(i,j+1,k+1,1,0,0), index(i,j,k+1,0,1,0)] - volumic_mesh.addBulk( element(type='Q8xxx', connectivity=connectivity, physicalEntity='up') ) + volumic_mesh.addBulk( element(elem_dim=2, connectivity=connectivity, physicalEntity='up') ) # left (i.e. y=y0) j = 0 @@ -1248,7 +1248,7 @@ for i in range(0, nb_elem_x): connectivity=[index(i,j,k), index(i+1,j,k), index(i+1,j,k+1), index(i,j,k+1), index(i,j,k,1,0,0), index(i+1,j,k,0,0,1), index(i,j,k+1,1,0,0), index(i,j,k,0,0,1)] - volumic_mesh.addBulk( element(type='Q8xxx', connectivity=connectivity, physicalEntity='left') ) + volumic_mesh.addBulk( element(elem_dim=2, connectivity=connectivity, physicalEntity='left') ) # right (i.e. y=y0 + ly) j = nb_elem_y - 1 @@ -1256,7 +1256,7 @@ for i in range(0, nb_elem_x): connectivity=[index(i+1,j+1,k), index(i,j+1,k), index(i,j+1,k+1), index(i+1,j+1,k+1), index(i,j+1,k,1,0,0), index(i,j+1,k,0,0,1), index(i,j+1,k+1,1,0,0), index(i+1,j+1,k,0,0,1)] - volumic_mesh.addBulk( element(type='Q8xxx', connectivity=connectivity, physicalEntity='right') ) + volumic_mesh.addBulk( element(elem_dim=2, connectivity=connectivity, physicalEntity='right') ) # rear (i.e. x=x0) i = 0 @@ -1264,7 +1264,7 @@ for j in range(0, nb_elem_y): connectivity=[index(i,j,k), index(i,j,k + 1), index(i,j+1,k+1), index(i,j+1,k), index(i,j,k,0,0,1), index(i,j,k+1,0,1,0), index(i,j+1,k,0,0,1), index(i,j,k,0,1,0)] - volumic_mesh.addBulk( element(type='Q8xxx', connectivity=connectivity, physicalEntity='rear') ) + volumic_mesh.addBulk( element(elem_dim=2, connectivity=connectivity, physicalEntity='rear') ) # front (i.e. x=x0 + lx) i = nb_elem_x - 1 @@ -1272,7 +1272,7 @@ for j in range(0, nb_elem_y): connectivity=[index(i+1,j,k), index(i+1,j+1,k), index(i+1,j+1,k+1), index(i+1,j,k+1), index(i+1,j,k,0,1,0), index(i+1,j+1,k,0,0,1), index(i+1,j,k+1,0,1,0), index(i+1,j,k,0,0,1)] - volumic_mesh.addBulk( element(type='Q8xxx', connectivity=connectivity, physicalEntity='front') ) + volumic_mesh.addBulk( element(elem_dim=2, connectivity=connectivity, physicalEntity='front') ) return volumic_mesh ##new_mesh = mesh(3) @@ -1284,11 +1284,11 @@ ## # new intermediate nodes ## for n in m2.nodes[::2]: ## new_coor = np.array([n.coor[0],n.coor[1],z0+nb_z*lz/(2*nb_elem_z)]) - ## new_mesh.addNode(node(type='NO3xx',coor=new_coor,number=l*nb_nodes+n.number)) + ## new_mesh.addNode(node(coor=new_coor,number=l*nb_nodes+n.number)) ## # new layer ## for n in m2.nodes: ## new_coor = np.array([n.coor[0],n.coor[1],z0+nb_z*lz/nb_elem_z]) - ## new_mesh.addNode(node(type='NO3xx',coor=new_coor,number=l*nb_nodes+n.number)) + ## new_mesh.addNode(node(coor=new_coor,number=l*nb_nodes+n.number))
@@ -1299,8 +1299,8 @@ \ No newline at end of file diff --git a/docs/Pre/_modules/pylmgc90/pre_lmgc/build_avatar/particles.html b/docs/Pre/_modules/pylmgc90/pre/build_avatar/particles.html similarity index 61% rename from docs/Pre/_modules/pylmgc90/pre_lmgc/build_avatar/particles.html rename to docs/Pre/_modules/pylmgc90/pre/build_avatar/particles.html index 6b1b48b8ff19f81a318b6ad4ac7bffac5e34bde9..9c6857b49997f4109259bfca5bfbaa7a08a3b158 100644 --- a/docs/Pre/_modules/pylmgc90/pre_lmgc/build_avatar/particles.html +++ b/docs/Pre/_modules/pylmgc90/pre/build_avatar/particles.html @@ -6,7 +6,7 @@ - pylmgc90.pre_lmgc.build_avatar.particles — pylmgc90.pre 2015.2 documentation + pylmgc90.pre.build_avatar.particles — pylmgc90.pre 2015.2 documentation @@ -46,21 +46,21 @@
-

Source code for pylmgc90.pre_lmgc.build_avatar.particles

+  

Source code for pylmgc90.pre.build_avatar.particles

 # module qui fournit des macros pour construire des particules
 
 import copy
 import random
 import numpy
 import math
-from pylmgc90.pre_lmgc.avatar.avatar import *
-from pylmgc90.pre_lmgc.avatar.bulk.rigid2d import *
-from pylmgc90.pre_lmgc.avatar.bulk.rigid3d import *
-from pylmgc90.pre_lmgc.avatar.bulk.element import *
+from pylmgc90.pre.avatar.avatar import *
+from pylmgc90.pre.avatar.bulk.rigid2d import *
+from pylmgc90.pre.avatar.bulk.rigid3d import *
+from pylmgc90.pre.avatar.bulk.element import *
 from mesh import *
-from pylmgc90.pre_lmgc.utilities.error    import *
+from pylmgc90.pre.utilities.error    import *
 
-
[docs]def rigidDisk(r, center, model, material, color='BLEUx', number=None, is_Hollow=False, is_Pneum=False): +
[docs]def rigidDisk(r, center, model, material, color='BLEUx', number=None, is_Hollow=False, is_Pneum=False): ''' usage: @@ -84,27 +84,27 @@ - is_Pneum = False: is the contactor to be a pneumatic one (DISPx instead of DISKx or xPSID instead of xKSID). ''' - body = avatar(type='RBDY2', dimension=2, number=number) - body.addBulk( rigid2d() ) - body.addNode( node(type='NO2xx',coor=numpy.array(center), number=1) ) + body = avatar(dimension=2, number=number) + body.addBulk( rigid2d() ) + body.addNode( node(coor=numpy.array(center), number=1) ) body.defineGroups() body.defineModel(model=model) body.defineMaterial(material=material) if is_Hollow: if is_Pneum: - body.addContactors(type='xPSID', color=color, byrd=r) + body.addContactors(shape='xPSID', color=color, byrd=r) else: - body.addContactors(type='xKSID', color=color, byrd=r) + body.addContactors(shape='xKSID', color=color, byrd=r) else: if is_Pneum: - body.addContactors(type='DISPx', color=color, byrd=r) + body.addContactors(shape='DISPx', color=color, byrd=r) else: - body.addContactors(type='DISKx', color=color, byrd=r) + body.addContactors(shape='DISKx', color=color, byrd=r) body.computeRigidProperties() return body
-
[docs]def rigidSphere(r, center, model, material, color='BLEUx', number=None): +
[docs]def rigidSphere(r, center, model, material, color='BLEUx', number=None): ''' usage: @@ -125,18 +125,18 @@ - color='BLEUx' : color of the contactor - number=None: index of the avatar (still present to ensure compatibility)''' - body = avatar(type='RBDY3', dimension=3, number=number) - body.addBulk( rigid3d() ) - body.addNode( node(type='NO3xx',coor=numpy.array(center), number=1) ) + body = avatar(dimension=3, number=number) + body.addBulk( rigid3d() ) + body.addNode( node(coor=numpy.array(center), number=1) ) body.defineGroups() body.defineModel(model=model) body.defineMaterial(material=material) - body.addContactors(type='SPHER', color=color, byrd=r) + body.addContactors(shape='SPHER', color=color, byrd=r) body.computeRigidProperties() return body
-
[docs]def rigidCylinder(r, h, center, model, material, color='BLEUx', number=None, is_Hollow=False): +
[docs]def rigidCylinder(r, h, center, model, material, color='BLEUx', number=None, is_Hollow=False): ''' usage: @@ -160,21 +160,21 @@ - is_Hollow = False: is the contactor to be a hollow one (DNLYC instead of CYLND) ''' - body = avatar(type='RBDY3', dimension=3, number=number) - body.addBulk( rigid3d() ) - body.addNode( node(type='NO3xx',coor=numpy.array(center), number=1) ) + body = avatar(dimension=3, number=number) + body.addBulk( rigid3d() ) + body.addNode( node(coor=numpy.array(center), number=1) ) body.defineGroups() body.defineModel(model=model) body.defineMaterial(material=material) if is_Hollow: - body.addContactors(type='DNLYC', color=color, byrd=r,High=h/2.) + body.addContactors(shape='DNLYC', color=color, byrd=r,High=h/2.) else: - body.addContactors(type='CYLND', color=color, byrd=r,High=h/2.) + body.addContactors(shape='CYLND', color=color, byrd=r,High=h/2.) body.computeRigidProperties() return body
-
[docs]def rigidJonc(axe1, axe2, center, model, material, color='BLEUx', number=None): +
[docs]def rigidJonc(axe1, axe2, center, model, material, color='BLEUx', number=None): ''' usage: @@ -196,18 +196,18 @@ - color='BLEUx' : color of the contactor - number=None: index of the avatar (still present to ensure compatibility)''' - body = avatar(type='RBDY2', dimension=2, number=number) + body = avatar(dimension=2, number=number) body.addBulk( rigid2d() ) - body.addNode(node(type='NO2xx',coor=numpy.array(center),number=1)) + body.addNode(node(coor=numpy.array(center),number=1)) body.defineGroups() body.defineModel(model=model) body.defineMaterial(material=material) - body.addContactors(type='JONCx', color=color, axe1=axe1, axe2=axe2) + body.addContactors(shape='JONCx', color=color, axe1=axe1, axe2=axe2) body.computeRigidProperties() return body
-
[docs]def rigidPlan(axe1, axe2, axe3, center, model, material, color='BLEUx', number=None): +
[docs]def rigidPlan(axe1, axe2, axe3, center, model, material, color='BLEUx', number=None): ''' usage: @@ -218,9 +218,9 @@ parameters : - - axe1 : half length of the jonc - - axe2 : half width of the jonc - - axe3 : half height of the jonc + - axe1 : half length of the plan + - axe2 : half width of the plan + - axe3 : half thickness of the plan - center : position of the center of inertia in the global frame, as a three coordinates vector - model : rigid model for the particle @@ -231,25 +231,25 @@ - color='BLEUx' : color of the contactor - number=None: index of the avatar (still present to ensure compatibility)''' - body = avatar(type='RBDY3', dimension=3, number=number) - body.addBulk( rigid3d() ) - body.addNode(node(type='NO3xx',coor=numpy.array(center),number=1)) + body = avatar(dimension=3, number=number) + body.addBulk( rigid3d() ) + body.addNode(node(coor=numpy.array(center),number=1)) body.defineGroups() body.defineModel(model=model) body.defineMaterial(material=material) - body.addContactors(type='PLANx', color=color, axe1=axe1, axe2=axe2, axe3=axe3) + body.addContactors(shape='PLANx', color=color, axe1=axe1, axe2=axe2, axe3=axe3) body.computeRigidProperties() return body
-
[docs]def rigidCluster(r, center, nb_disk, model, material, color='BLEUx', number=None): +
[docs]def rigidCluster(r, center, nb_disk, model, material, color='BLEUx', number=None): ''' usage: body=rigidCluster(r, center, nb_disk, model, material, color='BLEUx', number=None) - this function builds a rigid cluster of disks and returns the generated body + this function builds a rigid cluster of disks in a disk and returns the generated body parameters : @@ -264,9 +264,9 @@ - color='BLEUx' : color of the contactors - number=None: index of the avatar (still present to ensure compatibility)''' - body = avatar(type='RBDY2', dimension=2, number=number) - body.addBulk( rigid2d() ) - body.addNode( node(type='NO2xx',coor=numpy.array(center), number=1) ) + body = avatar(dimension=2, number=number) + body.addBulk( rigid2d() ) + body.addNode( node(coor=numpy.array(center), number=1) ) body.defineGroups() body.defineModel(model=model) body.defineMaterial(material=material) @@ -278,13 +278,13 @@ # on calcule la position de son centre par rapport au centre d'inertie x_disk = (r_disk - r)*math.cos(2.*math.pi*i/nb_disk) y_disk = (r_disk - r)*math.sin(2.*math.pi*i/nb_disk) - body.addContactors(type='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) + body.addContactors(shape='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) body.computeRigidProperties() return body
-
[docs]def rigidPolygon( model, material, center, theta=0., color='BLEUx', generation_type='regular', nb_vertices=0, vertices=None, radius=1., number=None): +
[docs]def rigidPolygon( model, material, center, theta=0., color='BLEUx', generation_type='regular', nb_vertices=0, vertices=None, radius=1., number=None): ''' usage: @@ -321,11 +321,11 @@ ''' # creation d'un nouveau polygone rigide 2D - body = avatar(type='RBDY2', dimension=2, number=number) + body = avatar(dimension=2, number=number) # on cree comportement volumique de type rigide - body.addBulk( rigid2d() ) + body.addBulk( rigid2d() ) # ajout de la position du centre d'inertie au disque - body.addNode(node(type='NO2xx',coor=numpy.array(center),number=1) ) + body.addNode(node(coor=numpy.array(center),number=1) ) # on definit les groupes pour le disque body.defineGroups() # on affecte son modele au disque @@ -343,11 +343,11 @@ vertices[i, 1] = radius*math.sin(2.*math.pi*i/float(nb_vertices)) # ajout de son contacteur au polygone - body.addContactors(type='POLYG', color=color, nb_vertices=nb_vertices, vertices=vertices) + body.addContactors(shape='POLYG', color=color, nb_vertices=nb_vertices, vertices=vertices) elif generation_type == 'full': # ajout de son contacteur au polygone - body.addContactors(type='POLYG', color=color, nb_vertices=vertices.shape[0], vertices=vertices) + body.addContactors(shape='POLYG', color=color, nb_vertices=vertices.shape[0], vertices=vertices) elif generation_type == 'bevel': # gestion des conges @@ -370,7 +370,7 @@ inv+=1 # ajout de son contacteur au polygone - body.addContactors(type='POLYG', color=color, nb_vertices=inv, vertices=nvertices) + body.addContactors(shape='POLYG', color=color, nb_vertices=inv, vertices=nvertices) else: showError('In rigidPolygon: unknow type '+generation_type) @@ -386,13 +386,13 @@ # on renvoie le corps genere return body
-
[docs]def rigidPolyhedron(model, material, center=numpy.zeros(3), color='BLEUx', generation_type='regular', - nb_vertices=0, vertices=None, faces=None, radius=1., tol=0., number=None): +
[docs]def rigidPolyhedron(model, material, center=numpy.zeros(3), color='BLEUx', generation_type='regular', + nb_vertices=0, vertices=None, faces=None, radius=1., tol=0., number=None, seed=None): ''' usage: body = rigidPolyhedron(model, material, center=numpy.zeros(3,'d'), generation_type='regular', color='BLEUx', - nb_vertices=0, vertices=None, faces=None, radius=1., tol=0., number=None) + nb_vertices=0, vertices=None, faces=None, radius=1., tol=0., number=None, s=None) This function builds a rigid convex polyhedron using 4 methods (see below). @@ -429,6 +429,7 @@ - nb_vertices=0. : number of vertices of the contactor - radius=1. : radius of the encompassing sphere. - tol=0. : tolerance to use to remove a vertex if the one found is to close to others (if 0. no check) + - seed=None : seed to use to control the randomness - Third method (generation_type ='vertices') generates the polyhedron defined by the convex hull of the vertices given in input. The 'vertices' array may be modified on output if the vertices @@ -447,8 +448,8 @@ ''' - body = avatar(type='RBDY3', dimension=3, number=number) - body.addBulk( rigid3d() ) + body = avatar(dimension=3, number=number) + body.addBulk( rigid3d() ) if type(center) != numpy.ndarray: try: @@ -457,7 +458,7 @@ showError('In rigidPolyhedron: center parameter must be convertible to a numpy array') #body.addNode( node(type='NO3xx',coor=numpy.array(center), number=1) ) - body.addNode( node(type='NO3xx',coor=numpy.zeros(3,'d'), number=1) ) + body.addNode( node(coor=numpy.zeros(3,'d'), number=1) ) body.defineGroups() body.defineModel(model=model) @@ -475,7 +476,7 @@ if nb_vertices < 4: showError('In rigidpolyhedron: nb_vertices must be > 4') # nodes generation - vertices = getRandomPolyhedronVertices(nb_vertices, radius, tol) + vertices = getRandomPolyhedronVertices(nb_vertices, radius, tol, seed) vertices += center # connectivity generation faces,vertices = buildPolyhedronConnectivity(vertices) @@ -498,7 +499,7 @@ else: showError('In rigidpolyhedron: unknow type '+generation_type) - body.addContactors(type='POLYR', color=color, nb_vertices=vertices.shape[0], vertices=vertices, + body.addContactors(shape='POLYR', color=color, nb_vertices=vertices.shape[0], vertices=vertices, nb_faces=len(faces), connectivity=faces) body.computeRigidProperties() @@ -506,7 +507,7 @@ # on renvoie le corps genere return body
-
[docs]def deformableParticle2D(r, center, type_part, model, material, color='BLEUx', number=None): +
[docs]def deformableParticle2D(r, center, type_part, model, material, color='BLEUx', number=None): """ usage: @@ -557,9 +558,9 @@ # on definit les contacteurs pour le corps : # * un contacteur candidat sur chaque noeud : - body.addContactors(group='S2xxx', type='CLxxx', color=color) + body.addContactors(group='S2xxx', shape='CLxxx', color=color) # * un contacteur antagoniste - body.addContactors(group='S2xxx', type='ALpxx', color=color) + body.addContactors(group='S2xxx', shape='ALpxx', color=color) # on renvoie l'objet genere return body
@@ -581,73 +582,73 @@ rad2 = math.cos(A36) # on ajoute les noeuds au maillage - mesh_penta.addNode( node(type='NO2xx', coor=numpy.array([ math.cos(3.*A72),math.sin(3.*A72) ]), number= 1) ) - mesh_penta.addNode( node(type='NO2xx', coor=numpy.array([ math.cos(2.*A72), 0.0000000e+00 ]), number= 2) ) - mesh_penta.addNode( node(type='NO2xx', coor=numpy.array([ math.cos(2.*A72),math.sin(2.*A72) ]), number= 3) ) + mesh_penta.addNode( node( coor=numpy.array([ math.cos(3.*A72),math.sin(3.*A72) ]), number= 1) ) + mesh_penta.addNode( node( coor=numpy.array([ math.cos(2.*A72), 0.0000000e+00 ]), number= 2) ) + mesh_penta.addNode( node( coor=numpy.array([ math.cos(2.*A72),math.sin(2.*A72) ]), number= 3) ) - mesh_penta.addNode( node(type='NO2xx', coor=numpy.array([ rad1*math.cos(3.*A72),rad1*math.sin(3.*A72) ]), number= 4) ) - mesh_penta.addNode( node(type='NO2xx', coor=numpy.array([-rad1, 0.0000000e+00 ]), number= 5) ) - mesh_penta.addNode( node(type='NO2xx', coor=numpy.array([ rad1*math.cos(2.*A72),rad1*math.sin(2.*A72) ]), number= 6) ) + mesh_penta.addNode( node( coor=numpy.array([ rad1*math.cos(3.*A72),rad1*math.sin(3.*A72) ]), number= 4) ) + mesh_penta.addNode( node( coor=numpy.array([-rad1, 0.0000000e+00 ]), number= 5) ) + mesh_penta.addNode( node( coor=numpy.array([ rad1*math.cos(2.*A72),rad1*math.sin(2.*A72) ]), number= 6) ) - mesh_penta.addNode( node(type='NO2xx', coor=numpy.array([ rad2*math.cos(7.*A36),rad2*math.sin(7.*A36) ]), number= 7) ) - mesh_penta.addNode( node(type='NO2xx', coor=numpy.array([ rad1*math.cos(7.*A36),rad1*math.sin(7.*A36) ]), number= 8) ) + mesh_penta.addNode( node( coor=numpy.array([ rad2*math.cos(7.*A36),rad2*math.sin(7.*A36) ]), number= 7) ) + mesh_penta.addNode( node( coor=numpy.array([ rad1*math.cos(7.*A36),rad1*math.sin(7.*A36) ]), number= 8) ) - mesh_penta.addNode( node(type='NO2xx', coor=numpy.array([ rad1*math.cos(3.*A36),rad1*math.sin(3.*A36) ]), number= 9) ) - mesh_penta.addNode( node(type='NO2xx', coor=numpy.array([ rad2*math.cos(3.*A36),rad2*math.sin(3.*A36) ]), number=10) ) + mesh_penta.addNode( node( coor=numpy.array([ rad1*math.cos(3.*A36),rad1*math.sin(3.*A36) ]), number= 9) ) + mesh_penta.addNode( node( coor=numpy.array([ rad2*math.cos(3.*A36),rad2*math.sin(3.*A36) ]), number=10) ) - mesh_penta.addNode( node(type='NO2xx', coor=numpy.array([ 0.0000000e+00 , 0.0000000e+00 ]), number=11) ) + mesh_penta.addNode( node( coor=numpy.array([ 0.0000000e+00 , 0.0000000e+00 ]), number=11) ) - mesh_penta.addNode( node(type='NO2xx', coor=numpy.array([ rad1*math.cos(4.*A72),rad1*math.sin(4.*A72) ]), number=12) ) - mesh_penta.addNode( node(type='NO2xx', coor=numpy.array([ rad1*math.cos(1.*A72),rad1*math.sin(1.*A72) ]), number=13) ) + mesh_penta.addNode( node( coor=numpy.array([ rad1*math.cos(4.*A72),rad1*math.sin(4.*A72) ]), number=12) ) + mesh_penta.addNode( node( coor=numpy.array([ rad1*math.cos(1.*A72),rad1*math.sin(1.*A72) ]), number=13) ) - mesh_penta.addNode( node(type='NO2xx', coor=numpy.array([ math.cos(4.*A72),math.sin(4.*A72) ]), number=14) ) - mesh_penta.addNode( node(type='NO2xx', coor=numpy.array([ rad1*math.cos(9.*A36),rad1*math.sin(9.*A36) ]), number=15) ) - mesh_penta.addNode( node(type='NO2xx', coor=numpy.array([ rad1, 0.0000000e+00 ]), number=16) ) - mesh_penta.addNode( node(type='NO2xx', coor=numpy.array([ rad1*math.cos(1.*A36),rad1*math.sin(1.*A36) ]), number=17) ) - mesh_penta.addNode( node(type='NO2xx', coor=numpy.array([ math.cos(1.*A72),math.sin(1.*A72) ]), number=18) ) + mesh_penta.addNode( node( coor=numpy.array([ math.cos(4.*A72),math.sin(4.*A72) ]), number=14) ) + mesh_penta.addNode( node( coor=numpy.array([ rad1*math.cos(9.*A36),rad1*math.sin(9.*A36) ]), number=15) ) + mesh_penta.addNode( node( coor=numpy.array([ rad1, 0.0000000e+00 ]), number=16) ) + mesh_penta.addNode( node( coor=numpy.array([ rad1*math.cos(1.*A36),rad1*math.sin(1.*A36) ]), number=17) ) + mesh_penta.addNode( node( coor=numpy.array([ math.cos(1.*A72),math.sin(1.*A72) ]), number=18) ) - mesh_penta.addNode( node(type='NO2xx', coor=numpy.array([ rad2*math.cos(9.*A36),rad2*math.sin(9.*A36) ]), number=19) ) - mesh_penta.addNode( node(type='NO2xx', coor=numpy.array([ rad2*math.cos(1.*A36),rad2*math.sin(1.*A36) ]), number=20) ) + mesh_penta.addNode( node( coor=numpy.array([ rad2*math.cos(9.*A36),rad2*math.sin(9.*A36) ]), number=19) ) + mesh_penta.addNode( node( coor=numpy.array([ rad2*math.cos(1.*A36),rad2*math.sin(1.*A36) ]), number=20) ) - mesh_penta.addNode( node(type='NO2xx', coor=numpy.array([ 1.0000000e+00 , 0.0000000e+00 ]), number=21) ) + mesh_penta.addNode( node( coor=numpy.array([ 1.0000000e+00 , 0.0000000e+00 ]), number=21) ) # on ajoute les elements au maillage # * les elements surfaciques - mesh_penta.addBulk( element(type='Q4xxx', connectivity=[ 1, 4, 5, 2]) ) - mesh_penta.addBulk( element(type='Q4xxx', connectivity=[ 2, 5 , 6, 3]) ) - mesh_penta.addBulk( element(type='Q4xxx', connectivity=[ 4, 11, 6, 5]) ) + mesh_penta.addBulk( element(elem_dim=2, connectivity=[ 1, 4, 5, 2]) ) + mesh_penta.addBulk( element(elem_dim=2, connectivity=[ 2, 5 , 6, 3]) ) + mesh_penta.addBulk( element(elem_dim=2, connectivity=[ 4, 11, 6, 5]) ) - mesh_penta.addBulk( element(type='Q4xxx', connectivity=[ 6, 9, 10, 3]) ) - mesh_penta.addBulk( element(type='Q4xxx', connectivity=[ 1, 7, 8, 4]) ) - mesh_penta.addBulk( element(type='Q4xxx', connectivity=[ 7, 14, 12, 8]) ) + mesh_penta.addBulk( element(elem_dim=2, connectivity=[ 6, 9, 10, 3]) ) + mesh_penta.addBulk( element(elem_dim=2, connectivity=[ 1, 7, 8, 4]) ) + mesh_penta.addBulk( element(elem_dim=2, connectivity=[ 7, 14, 12, 8]) ) - mesh_penta.addBulk( element(type='Q4xxx', connectivity=[ 4, 8, 12, 11]) ) - mesh_penta.addBulk( element(type='Q4xxx', connectivity=[ 6, 11, 13, 9]) ) - mesh_penta.addBulk( element(type='Q4xxx', connectivity=[ 9, 13 ,18, 10]) ) + mesh_penta.addBulk( element(elem_dim=2, connectivity=[ 4, 8, 12, 11]) ) + mesh_penta.addBulk( element(elem_dim=2, connectivity=[ 6, 11, 13, 9]) ) + mesh_penta.addBulk( element(elem_dim=2, connectivity=[ 9, 13 ,18, 10]) ) - mesh_penta.addBulk( element(type='Q4xxx', connectivity=[14, 19, 15, 12]) ) - mesh_penta.addBulk( element(type='Q4xxx', connectivity=[19, 21, 16, 15]) ) - mesh_penta.addBulk( element(type='Q4xxx', connectivity=[12, 15, 16, 11]) ) + mesh_penta.addBulk( element(elem_dim=2, connectivity=[14, 19, 15, 12]) ) + mesh_penta.addBulk( element(elem_dim=2, connectivity=[19, 21, 16, 15]) ) + mesh_penta.addBulk( element(elem_dim=2, connectivity=[12, 15, 16, 11]) ) - mesh_penta.addBulk( element(type='Q4xxx', connectivity=[11, 16, 17, 13]) ) - mesh_penta.addBulk( element(type='Q4xxx', connectivity=[16, 21, 20, 17]) ) - mesh_penta.addBulk( element(type='Q4xxx', connectivity=[17, 20, 18, 13]) ) + mesh_penta.addBulk( element(elem_dim=2, connectivity=[11, 16, 17, 13]) ) + mesh_penta.addBulk( element(elem_dim=2, connectivity=[16, 21, 20, 17]) ) + mesh_penta.addBulk( element(elem_dim=2, connectivity=[17, 20, 18, 13]) ) # * les elements lineiques # N.B.: la connectivite est donne dans le sens antitrigonmetrique qui # est le sens conventionnel pour decrire les contacteurs - mesh_penta.addBulk( element(type='S2xxx', connectivity=[ 7, 1], physicalEntity='skin') ) - mesh_penta.addBulk( element(type='S2xxx', connectivity=[ 1, 2], physicalEntity='skin') ) - mesh_penta.addBulk( element(type='S2xxx', connectivity=[ 2, 3], physicalEntity='skin') ) - mesh_penta.addBulk( element(type='S2xxx', connectivity=[ 3, 10], physicalEntity='skin') ) - mesh_penta.addBulk( element(type='S2xxx', connectivity=[10, 18], physicalEntity='skin') ) - mesh_penta.addBulk( element(type='S2xxx', connectivity=[18, 20], physicalEntity='skin') ) - mesh_penta.addBulk( element(type='S2xxx', connectivity=[20, 21], physicalEntity='skin') ) - mesh_penta.addBulk( element(type='S2xxx', connectivity=[21, 19], physicalEntity='skin') ) - mesh_penta.addBulk( element(type='S2xxx', connectivity=[19, 14], physicalEntity='skin') ) - mesh_penta.addBulk( element(type='S2xxx', connectivity=[14, 7], physicalEntity='skin') ) + mesh_penta.addBulk( element(elem_dim=1, connectivity=[ 7, 1], physicalEntity='skin') ) + mesh_penta.addBulk( element(elem_dim=1, connectivity=[ 1, 2], physicalEntity='skin') ) + mesh_penta.addBulk( element(elem_dim=1, connectivity=[ 2, 3], physicalEntity='skin') ) + mesh_penta.addBulk( element(elem_dim=1, connectivity=[ 3, 10], physicalEntity='skin') ) + mesh_penta.addBulk( element(elem_dim=1, connectivity=[10, 18], physicalEntity='skin') ) + mesh_penta.addBulk( element(elem_dim=1, connectivity=[18, 20], physicalEntity='skin') ) + mesh_penta.addBulk( element(elem_dim=1, connectivity=[20, 21], physicalEntity='skin') ) + mesh_penta.addBulk( element(elem_dim=1, connectivity=[21, 19], physicalEntity='skin') ) + mesh_penta.addBulk( element(elem_dim=1, connectivity=[19, 14], physicalEntity='skin') ) + mesh_penta.addBulk( element(elem_dim=1, connectivity=[14, 7], physicalEntity='skin') ) # on renvoie le maillage ainsi construit return mesh_penta @@ -665,63 +666,63 @@ # on ajoute les noeuds au maillage - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([ 0.0000000e+00, 0.0000000e+00]), number= 1) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([ 0.5000000e-02, 0.0000000e+00]), number= 2) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([ 0.0000000e+00, 0.5000000e-02]), number= 3) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([ 0.4267767e-02, 0.4267767e-02]), number= 4) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([ 0.1000000e-01, 0.0000000e+00]), number= 5) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([ 0.1500000e-01, 0.0000000e+00]), number= 6) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([ 0.8535534e-02, 0.3535534e-02]), number= 7) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([ 0.1350656e-01, 0.5594601e-02]), number= 8) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([ 0.7071068e-02, 0.7071068e-02]), number= 9) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([ 0.1060660e-01, 0.1060660e-01]), number=10) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([ 0.3535534e-02, 0.8535534e-02]), number=11) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([ 0.5594601e-02, 0.1350656e-01]), number=12) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([ 0.0000000e+00, -0.5000000e-02]), number=13) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([ 0.4267767e-02, -0.4267767e-02]), number=14) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([ 0.8535534e-02, -0.3535534e-02]), number=15) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([ 0.1350656e-01, -0.5594601e-02]), number=16) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([ 0.7071068e-02, -0.7071068e-02]), number=17) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([ 0.1060660e-01, -0.1060660e-01]), number=18) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([ 0.3535534e-02, -0.8535534e-02]), number=19) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([ 0.5594601e-02, -0.1350656e-01]), number=20) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([-0.5000000e-02, 0.0000000e+00]), number=21) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([-0.4267767e-02, 0.4267767e-02]), number=22) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([-0.1000000e-01, 0.0000000e+00]), number=23) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([-0.1500000e-01, 0.0000000e+00]), number=24) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([-0.8535534e-02, 0.3535534e-02]), number=25) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([-0.1350656e-01, 0.5594601e-02]), number=26) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([-0.7071068e-02, 0.7071068e-02]), number=27) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([-0.1060660e-01, 0.1060660e-01]), number=28) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([-0.3535534e-02, 0.8535534e-02]), number=29) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([-0.5594601e-02, 0.1350656e-01]), number=30) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([-0.4267767e-02, -0.4267767e-02]), number=31) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([-0.8535534e-02, -0.3535534e-02]), number=32) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([-0.1350656e-01, -0.5594601e-02]), number=33) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([-0.7071068e-02, -0.7071068e-02]), number=34) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([-0.1060660e-01, -0.1060660e-01]), number=35) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([-0.3535534e-02, -0.8535534e-02]), number=36) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([-0.5594601e-02, -0.1350656e-01]), number=37) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([ 0.2000000e-01, 0.0000000e+00]), number=38) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([ 0.1847759e-01, 0.7653669e-02]), number=39) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([ 0.1414214e-01, 0.1414214e-01]), number=40) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([ 0.7653669e-02, 0.1847759e-01]), number=41) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([ 0.0000000e+00, -0.1000000e-01]), number=42) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([ 0.0000000e+00, -0.1500000e-01]), number=43) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([ 0.0000000e+00, 0.1000000e-01]), number=44) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([ 0.0000000e+00, 0.1500000e-01]), number=45) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([-0.2000000e-01, 0.0000000e+00]), number=46) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([-0.1847759e-01, -0.7653669e-02]), number=47) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([-0.1414214e-01, -0.1414214e-01]), number=48) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([-0.7653669e-02, -0.1847759e-01]), number=49) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([ 0.0000000e+00, 0.2000000e-01]), number=50) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([ 0.1847759e-01, -0.7653669e-02]), number=51) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([ 0.1414214e-01, -0.1414214e-01]), number=52) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([ 0.7653669e-02, -0.1847759e-01]), number=53) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([ 0.0000000e+00, -0.2000000e-01]), number=54) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([-0.1847759e-01, 0.7653669e-02]), number=55) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([-0.1414214e-01, 0.1414214e-01]), number=56) ) - mesh_disk.addNode( node(type='NO2xx', coor=numpy.array([-0.7653669e-02, 0.1847759e-01]), number=57) ) + mesh_disk.addNode( node( coor=numpy.array([ 0.0000000e+00, 0.0000000e+00]), number= 1) ) + mesh_disk.addNode( node( coor=numpy.array([ 0.5000000e-02, 0.0000000e+00]), number= 2) ) + mesh_disk.addNode( node( coor=numpy.array([ 0.0000000e+00, 0.5000000e-02]), number= 3) ) + mesh_disk.addNode( node( coor=numpy.array([ 0.4267767e-02, 0.4267767e-02]), number= 4) ) + mesh_disk.addNode( node( coor=numpy.array([ 0.1000000e-01, 0.0000000e+00]), number= 5) ) + mesh_disk.addNode( node( coor=numpy.array([ 0.1500000e-01, 0.0000000e+00]), number= 6) ) + mesh_disk.addNode( node( coor=numpy.array([ 0.8535534e-02, 0.3535534e-02]), number= 7) ) + mesh_disk.addNode( node( coor=numpy.array([ 0.1350656e-01, 0.5594601e-02]), number= 8) ) + mesh_disk.addNode( node( coor=numpy.array([ 0.7071068e-02, 0.7071068e-02]), number= 9) ) + mesh_disk.addNode( node( coor=numpy.array([ 0.1060660e-01, 0.1060660e-01]), number=10) ) + mesh_disk.addNode( node( coor=numpy.array([ 0.3535534e-02, 0.8535534e-02]), number=11) ) + mesh_disk.addNode( node( coor=numpy.array([ 0.5594601e-02, 0.1350656e-01]), number=12) ) + mesh_disk.addNode( node( coor=numpy.array([ 0.0000000e+00, -0.5000000e-02]), number=13) ) + mesh_disk.addNode( node( coor=numpy.array([ 0.4267767e-02, -0.4267767e-02]), number=14) ) + mesh_disk.addNode( node( coor=numpy.array([ 0.8535534e-02, -0.3535534e-02]), number=15) ) + mesh_disk.addNode( node( coor=numpy.array([ 0.1350656e-01, -0.5594601e-02]), number=16) ) + mesh_disk.addNode( node( coor=numpy.array([ 0.7071068e-02, -0.7071068e-02]), number=17) ) + mesh_disk.addNode( node( coor=numpy.array([ 0.1060660e-01, -0.1060660e-01]), number=18) ) + mesh_disk.addNode( node( coor=numpy.array([ 0.3535534e-02, -0.8535534e-02]), number=19) ) + mesh_disk.addNode( node( coor=numpy.array([ 0.5594601e-02, -0.1350656e-01]), number=20) ) + mesh_disk.addNode( node( coor=numpy.array([-0.5000000e-02, 0.0000000e+00]), number=21) ) + mesh_disk.addNode( node( coor=numpy.array([-0.4267767e-02, 0.4267767e-02]), number=22) ) + mesh_disk.addNode( node( coor=numpy.array([-0.1000000e-01, 0.0000000e+00]), number=23) ) + mesh_disk.addNode( node( coor=numpy.array([-0.1500000e-01, 0.0000000e+00]), number=24) ) + mesh_disk.addNode( node( coor=numpy.array([-0.8535534e-02, 0.3535534e-02]), number=25) ) + mesh_disk.addNode( node( coor=numpy.array([-0.1350656e-01, 0.5594601e-02]), number=26) ) + mesh_disk.addNode( node( coor=numpy.array([-0.7071068e-02, 0.7071068e-02]), number=27) ) + mesh_disk.addNode( node( coor=numpy.array([-0.1060660e-01, 0.1060660e-01]), number=28) ) + mesh_disk.addNode( node( coor=numpy.array([-0.3535534e-02, 0.8535534e-02]), number=29) ) + mesh_disk.addNode( node( coor=numpy.array([-0.5594601e-02, 0.1350656e-01]), number=30) ) + mesh_disk.addNode( node( coor=numpy.array([-0.4267767e-02, -0.4267767e-02]), number=31) ) + mesh_disk.addNode( node( coor=numpy.array([-0.8535534e-02, -0.3535534e-02]), number=32) ) + mesh_disk.addNode( node( coor=numpy.array([-0.1350656e-01, -0.5594601e-02]), number=33) ) + mesh_disk.addNode( node( coor=numpy.array([-0.7071068e-02, -0.7071068e-02]), number=34) ) + mesh_disk.addNode( node( coor=numpy.array([-0.1060660e-01, -0.1060660e-01]), number=35) ) + mesh_disk.addNode( node( coor=numpy.array([-0.3535534e-02, -0.8535534e-02]), number=36) ) + mesh_disk.addNode( node( coor=numpy.array([-0.5594601e-02, -0.1350656e-01]), number=37) ) + mesh_disk.addNode( node( coor=numpy.array([ 0.2000000e-01, 0.0000000e+00]), number=38) ) + mesh_disk.addNode( node( coor=numpy.array([ 0.1847759e-01, 0.7653669e-02]), number=39) ) + mesh_disk.addNode( node( coor=numpy.array([ 0.1414214e-01, 0.1414214e-01]), number=40) ) + mesh_disk.addNode( node( coor=numpy.array([ 0.7653669e-02, 0.1847759e-01]), number=41) ) + mesh_disk.addNode( node( coor=numpy.array([ 0.0000000e+00, -0.1000000e-01]), number=42) ) + mesh_disk.addNode( node( coor=numpy.array([ 0.0000000e+00, -0.1500000e-01]), number=43) ) + mesh_disk.addNode( node( coor=numpy.array([ 0.0000000e+00, 0.1000000e-01]), number=44) ) + mesh_disk.addNode( node( coor=numpy.array([ 0.0000000e+00, 0.1500000e-01]), number=45) ) + mesh_disk.addNode( node( coor=numpy.array([-0.2000000e-01, 0.0000000e+00]), number=46) ) + mesh_disk.addNode( node( coor=numpy.array([-0.1847759e-01, -0.7653669e-02]), number=47) ) + mesh_disk.addNode( node( coor=numpy.array([-0.1414214e-01, -0.1414214e-01]), number=48) ) + mesh_disk.addNode( node( coor=numpy.array([-0.7653669e-02, -0.1847759e-01]), number=49) ) + mesh_disk.addNode( node( coor=numpy.array([ 0.0000000e+00, 0.2000000e-01]), number=50) ) + mesh_disk.addNode( node( coor=numpy.array([ 0.1847759e-01, -0.7653669e-02]), number=51) ) + mesh_disk.addNode( node( coor=numpy.array([ 0.1414214e-01, -0.1414214e-01]), number=52) ) + mesh_disk.addNode( node( coor=numpy.array([ 0.7653669e-02, -0.1847759e-01]), number=53) ) + mesh_disk.addNode( node( coor=numpy.array([ 0.0000000e+00, -0.2000000e-01]), number=54) ) + mesh_disk.addNode( node( coor=numpy.array([-0.1847759e-01, 0.7653669e-02]), number=55) ) + mesh_disk.addNode( node( coor=numpy.array([-0.1414214e-01, 0.1414214e-01]), number=56) ) + mesh_disk.addNode( node( coor=numpy.array([-0.7653669e-02, 0.1847759e-01]), number=57) ) # am : magouille heritee de preprogranul... for nod in mesh_disk.nodes: @@ -730,74 +731,74 @@ # on ajoute les elements au maillage # * les elements surfaciques - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[ 1, 2, 4, 3]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[ 2, 5 , 7, 4]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[ 3, 4, 11, 44]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[ 4, 7, 9, 11]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[ 5, 6, 8, 7]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[ 6, 38, 39, 8]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[ 7, 8, 10, 9]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[ 8, 39, 40, 10]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[ 9, 10 ,12, 11]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[10, 40, 41, 12]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[11, 12, 45, 44]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[12, 41, 50, 45]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[ 1, 13, 14, 2]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[ 2, 14, 15, 5]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[13, 42, 19, 14]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[14, 19, 17, 15]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[ 5, 15, 16, 6]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[ 6, 16, 51, 38]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[15, 17, 18, 16]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[16, 18, 52, 51]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[17, 19, 20, 18]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[18, 20, 53, 52]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[19, 42, 43, 20]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[20, 43, 54, 53]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[ 1, 3, 22, 21]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[21, 22, 25, 23]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[ 3, 44, 29, 22]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[22, 29, 27, 25]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[23, 25, 26, 24]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[24, 26, 55, 46]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[25, 27 ,28, 26]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[26, 28, 56, 55]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[27, 29, 30, 28]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[28, 30, 57, 56]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[29, 44, 45, 30]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[30, 45, 50, 57]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[ 1, 21, 31, 13]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[21, 23, 32, 31]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[13, 31, 36, 42]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[31, 32, 34, 36]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[23, 24, 33, 32]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[24, 46, 47, 33]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[32, 33, 35, 34]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[33, 47, 48, 35]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[34, 35, 37, 36]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[35, 48, 49, 37]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[36, 37, 43, 42]) ) - mesh_disk.addBulk( element(type='Q4xxx', connectivity=[37, 49, 54, 43]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[ 1, 2, 4, 3]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[ 2, 5 , 7, 4]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[ 3, 4, 11, 44]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[ 4, 7, 9, 11]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[ 5, 6, 8, 7]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[ 6, 38, 39, 8]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[ 7, 8, 10, 9]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[ 8, 39, 40, 10]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[ 9, 10 ,12, 11]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[10, 40, 41, 12]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[11, 12, 45, 44]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[12, 41, 50, 45]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[ 1, 13, 14, 2]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[ 2, 14, 15, 5]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[13, 42, 19, 14]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[14, 19, 17, 15]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[ 5, 15, 16, 6]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[ 6, 16, 51, 38]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[15, 17, 18, 16]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[16, 18, 52, 51]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[17, 19, 20, 18]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[18, 20, 53, 52]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[19, 42, 43, 20]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[20, 43, 54, 53]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[ 1, 3, 22, 21]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[21, 22, 25, 23]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[ 3, 44, 29, 22]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[22, 29, 27, 25]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[23, 25, 26, 24]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[24, 26, 55, 46]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[25, 27 ,28, 26]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[26, 28, 56, 55]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[27, 29, 30, 28]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[28, 30, 57, 56]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[29, 44, 45, 30]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[30, 45, 50, 57]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[ 1, 21, 31, 13]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[21, 23, 32, 31]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[13, 31, 36, 42]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[31, 32, 34, 36]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[23, 24, 33, 32]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[24, 46, 47, 33]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[32, 33, 35, 34]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[33, 47, 48, 35]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[34, 35, 37, 36]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[35, 48, 49, 37]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[36, 37, 43, 42]) ) + mesh_disk.addBulk( element(elem_dim=2, connectivity=[37, 49, 54, 43]) ) # * les elements lineiques # N.B.: la connectivite est donne dans le sens antitrigonmetrique qui # est le sens conventionnel pour decrire les contacteurs - mesh_disk.addBulk( element(type='S2xxx', connectivity=[54, 49], physicalEntity='skin') ) - mesh_disk.addBulk( element(type='S2xxx', connectivity=[49, 48], physicalEntity='skin') ) - mesh_disk.addBulk( element(type='S2xxx', connectivity=[48, 47], physicalEntity='skin') ) - mesh_disk.addBulk( element(type='S2xxx', connectivity=[47, 46], physicalEntity='skin') ) - mesh_disk.addBulk( element(type='S2xxx', connectivity=[46, 55], physicalEntity='skin') ) - mesh_disk.addBulk( element(type='S2xxx', connectivity=[55, 56], physicalEntity='skin') ) - mesh_disk.addBulk( element(type='S2xxx', connectivity=[56, 57], physicalEntity='skin') ) - mesh_disk.addBulk( element(type='S2xxx', connectivity=[57, 50], physicalEntity='skin') ) - mesh_disk.addBulk( element(type='S2xxx', connectivity=[50, 41], physicalEntity='skin') ) - mesh_disk.addBulk( element(type='S2xxx', connectivity=[41, 40], physicalEntity='skin') ) - mesh_disk.addBulk( element(type='S2xxx', connectivity=[40, 39], physicalEntity='skin') ) - mesh_disk.addBulk( element(type='S2xxx', connectivity=[39, 38], physicalEntity='skin') ) - mesh_disk.addBulk( element(type='S2xxx', connectivity=[38, 51], physicalEntity='skin') ) - mesh_disk.addBulk( element(type='S2xxx', connectivity=[51, 52], physicalEntity='skin') ) - mesh_disk.addBulk( element(type='S2xxx', connectivity=[52, 53], physicalEntity='skin') ) - mesh_disk.addBulk( element(type='S2xxx', connectivity=[53, 54], physicalEntity='skin') ) + mesh_disk.addBulk( element(elem_dim=1, connectivity=[54, 49], physicalEntity='skin') ) + mesh_disk.addBulk( element(elem_dim=1, connectivity=[49, 48], physicalEntity='skin') ) + mesh_disk.addBulk( element(elem_dim=1, connectivity=[48, 47], physicalEntity='skin') ) + mesh_disk.addBulk( element(elem_dim=1, connectivity=[47, 46], physicalEntity='skin') ) + mesh_disk.addBulk( element(elem_dim=1, connectivity=[46, 55], physicalEntity='skin') ) + mesh_disk.addBulk( element(elem_dim=1, connectivity=[55, 56], physicalEntity='skin') ) + mesh_disk.addBulk( element(elem_dim=1, connectivity=[56, 57], physicalEntity='skin') ) + mesh_disk.addBulk( element(elem_dim=1, connectivity=[57, 50], physicalEntity='skin') ) + mesh_disk.addBulk( element(elem_dim=1, connectivity=[50, 41], physicalEntity='skin') ) + mesh_disk.addBulk( element(elem_dim=1, connectivity=[41, 40], physicalEntity='skin') ) + mesh_disk.addBulk( element(elem_dim=1, connectivity=[40, 39], physicalEntity='skin') ) + mesh_disk.addBulk( element(elem_dim=1, connectivity=[39, 38], physicalEntity='skin') ) + mesh_disk.addBulk( element(elem_dim=1, connectivity=[38, 51], physicalEntity='skin') ) + mesh_disk.addBulk( element(elem_dim=1, connectivity=[51, 52], physicalEntity='skin') ) + mesh_disk.addBulk( element(elem_dim=1, connectivity=[52, 53], physicalEntity='skin') ) + mesh_disk.addBulk( element(elem_dim=1, connectivity=[53, 54], physicalEntity='skin') ) # on renvoie le maillage ainsi construit return mesh_disk @@ -805,7 +806,7 @@ #################################################################################### # EXOTIC PURPOSE # -
[docs]def rigidDiscreteDisk(r, center, model, material, color='BLEUx', number=None): +
[docs]def rigidDiscreteDisk(r, center, model, material, color='BLEUx', number=None): '''body=rigidDiscreteDisk(r, center, model, material, color='BLEUx', number=None): this function builds a rigid cluster of diskx contained in a disk and returns the generated body @@ -823,12 +824,12 @@ - number=None: index of the avatar (still present to ensure compatibility)''' # creation d'un nouveau disque rigide 2D - body = avatar(type='RBDY2', dimension=2, number=number) + body = avatar(dimension=2, number=number) # on cree comportement volumique de type rigide body.addBulk( rigid2d() ) # ajout de la position du centre d'inertie au disque body.addNode( - node(type='NO2xx',coor=numpy.array(center), + node(coor=numpy.array(center), number=1) ) # on definit les groupes pour le disque body.defineGroups() @@ -837,107 +838,107 @@ # on affecte son materiau au disque body.defineMaterial(material=material) - # pre_lmgcmier niveau + # premier niveau r_disk = 0.5*r x_disk = -r*0.5 y_disk = 0 - body.addContactors(type='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) + body.addContactors(shape='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) x_disk = r*0.5 y_disk = 0 - body.addContactors(type='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) + body.addContactors(shape='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) # Second niveau r_disk = 0.25*r x_disk =-r*0.25 y_disk = r*0.7 - body.addContactors(type='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) + body.addContactors(shape='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) x_disk = r*0.25 y_disk = r*0.7 - body.addContactors(type='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) + body.addContactors(shape='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) x_disk =-r*0.25 y_disk =-r*0.7 - body.addContactors(type='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) + body.addContactors(shape='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) x_disk = r*0.25 y_disk =-r*0.7 - body.addContactors(type='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) + body.addContactors(shape='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) #Troisieme niveau r_disk = 0.125*r x_disk =-r*0.62 y_disk = r*0.62 - body.addContactors(type='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) + body.addContactors(shape='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) x_disk = r*0.62 y_disk = r*0.62 - body.addContactors(type='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) + body.addContactors(shape='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) x_disk =-r*0.62 y_disk =-r*0.62 - body.addContactors(type='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) + body.addContactors(shape='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) x_disk = r*0.62 y_disk =-r*0.62 - body.addContactors(type='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) + body.addContactors(shape='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) # Quatrieme niveau r_disk = 0.06*r x_disk =-r*0.06 y_disk = r*0.94 - body.addContactors(type='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) + body.addContactors(shape='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) x_disk = r*0.06 y_disk = r*0.94 - body.addContactors(type='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) + body.addContactors(shape='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) x_disk =-r*0.06 y_disk =-r*0.94 - body.addContactors(type='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) + body.addContactors(shape='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) x_disk = r*0.06 y_disk =-r*0.94 - body.addContactors(type='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) + body.addContactors(shape='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) r_disk = 0.07*r x_disk =-r*0.78 y_disk = r*0.50 - body.addContactors(type='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) + body.addContactors(shape='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) x_disk = r*0.78 y_disk = r*0.50 - body.addContactors(type='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) + body.addContactors(shape='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) x_disk =-r*0.78 y_disk =-r*0.50 - body.addContactors(type='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) + body.addContactors(shape='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) x_disk = r*0.78 y_disk =-r*0.50 - body.addContactors(type='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) + body.addContactors(shape='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) r_disk = 0.082*r x_disk =-r*0.082 y_disk = r*0.41 - body.addContactors(type='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) + body.addContactors(shape='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) x_disk = r*0.082 y_disk = r*0.41 - body.addContactors(type='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) + body.addContactors(shape='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) x_disk =-r*0.082 y_disk =-r*0.41 - body.addContactors(type='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) + body.addContactors(shape='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) x_disk = r*0.082 y_disk =-r*0.41 - body.addContactors(type='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) + body.addContactors(shape='DISKx', color=color, byrd=r_disk, shift=[x_disk, y_disk]) # on calcule de la surface et de l'inertie du disque @@ -959,7 +960,7 @@ # variables optionnelles # - theta : rotation du disque autour de son centre d'inertie # - color : couleur du polygone -
[docs]def rigidOvoidPolygon(ra, rb, nb_vertices, center, model, material, theta=0., color='BLEUx', number=None): +
[docs]def rigidOvoidPolygon(ra, rb, nb_vertices, center, model, material, theta=0., color='BLEUx', number=None): ''' usage : @@ -983,9 +984,9 @@ - number=None : index of the body ''' - body = avatar(type='RBDY2', dimension=2, number=number) - body.addBulk( rigid2d() ) - body.addNode( node(type='NO2xx',coor=numpy.array(center), number=1) ) + body = avatar(dimension=2, number=number) + body.addBulk( rigid2d() ) + body.addNode( node(coor=numpy.array(center), number=1) ) body.defineGroups() body.defineModel(model=model) body.defineMaterial(material=material) @@ -996,7 +997,7 @@ for i in xrange(0, nb_vertices, 1): vertices[i, 0] = ra*math.cos(2.*math.pi*i/float(nb_vertices)) vertices[i, 1] = rb*math.sin(2.*math.pi*i/float(nb_vertices)) - body.addContactors(type='POLYG', color=color, nb_vertices=nb_vertices, vertices=vertices) + body.addContactors(shape='POLYG', color=color, nb_vertices=nb_vertices, vertices=vertices) body.computeRigidProperties() @@ -1151,8 +1152,8 @@ return faces, vertices -def getRandomPolyhedronVertices(nb_vertices, radius, tol): - """ vertices = getRandomPolyhedronVertices(nb_vertices, radius, tol) +def getRandomPolyhedronVertices(nb_vertices, radius, tol, seed=None): + """ vertices = getRandomPolyhedronVertices(nb_vertices, radius, tol, s=None) Generate randomly disposed vertices on a sphere @@ -1162,7 +1163,13 @@ - radius : radius of the sphere on which the vertices are put - tol : tolerance to use to remove a vertex if the one found is to close to others (if 0. no check) - vertices : the numpy array containing the coordinates of the vertices + + optional: + - seed=None : seed to use to control the randomness """ + + if seed is not None : numpy.random.seed(s) + vertices = numpy.random.rand(nb_vertices, 3) vertices[:,0] = radius vertices[:,1] *= math.pi @@ -1340,12 +1347,12 @@ ''' # creation d'un nouveau polygone rigide 2D - body = avatar(type='RBDY2', dimension=2, number=number) + body = avatar(dimension=2, number=number) # on cree comportement volumique de type rigide - body.addBulk( rigid2d() ) + body.addBulk( rigid2d() ) # ajout de la position du centre d'inertie au disque body.addNode( - node(type='NO2xx',coor=numpy.array(center), + node(coor=numpy.array(center), number=1) ) # on definit les groupes pour le disque body.defineGroups() @@ -1368,7 +1375,7 @@ vertices[3, 0] = ra vertices[3, 1] =-rb - body.addContactors(type='POLYG', color='INTER', nb_vertices=4, vertices=vertices) + body.addContactors(shape='POLYG', color='INTER', nb_vertices=4, vertices=vertices) vertices[0, 0] =-ra vertices[0, 1] = rb @@ -1379,7 +1386,7 @@ vertices[3, 0] =-ra vertices[3, 1] =-rb - body.addContactors(type='POLYG', color='EXTER', nb_vertices=4, vertices=vertices) + body.addContactors(shape='POLYG', color='EXTER', nb_vertices=4, vertices=vertices) vertices[0, 0] = ra vertices[0, 1] = rb @@ -1390,7 +1397,7 @@ vertices[3, 0] = ra vertices[3, 1] =-rb - body.addContactors(type='POLYG', color='EXTER', nb_vertices=4, vertices=vertices) + body.addContactors(shape='POLYG', color='EXTER', nb_vertices=4, vertices=vertices) # on calcule de la surface et de l'inertie du cluster body.computeRigidProperties() @@ -1412,8 +1419,8 @@ \ No newline at end of file diff --git a/docs/Pre/_modules/pylmgc90/pre_lmgc/build_avatar/tools/containers2D.html b/docs/Pre/_modules/pylmgc90/pre/build_avatar/tools/containers2D.html similarity index 91% rename from docs/Pre/_modules/pylmgc90/pre_lmgc/build_avatar/tools/containers2D.html rename to docs/Pre/_modules/pylmgc90/pre/build_avatar/tools/containers2D.html index 1e98ff8100edda26d668f8657e5ef2664a2760fd..baf33ebb041f688fb5071b9eb217d34ff3b4394f 100644 --- a/docs/Pre/_modules/pylmgc90/pre_lmgc/build_avatar/tools/containers2D.html +++ b/docs/Pre/_modules/pylmgc90/pre/build_avatar/tools/containers2D.html @@ -6,7 +6,7 @@ - pylmgc90.pre_lmgc.build_avatar.tools.containers2D — pylmgc90.pre 2015.2 documentation + pylmgc90.pre.build_avatar.tools.containers2D — pylmgc90.pre 2015.2 documentation @@ -46,11 +46,11 @@
-

Source code for pylmgc90.pre_lmgc.build_avatar.tools.containers2D

+  

Source code for pylmgc90.pre.build_avatar.tools.containers2D

 # module fournissant des macros de depot dans des conteneurs predifnis
 
 # import du module permettant de savoir si on pourra importer les pre_tools
-from pylmgc90.pre_lmgc.utilities.check_compiled_modules import *
+from pylmgc90.pre.utilities.check_compiled_modules import *
 
 # import des des wrappers des anciens pre-processeurs pour les milieux granualaires
 
@@ -68,7 +68,7 @@
 # ATTENTION : radii peut etret modifie suite a l'appel a ces fonctions!
 
 # fonction qui depose les particules dans une boite rectangulaire
-
[docs]def depositInBox2D(radii, lx, ly, deposited_radii=None, deposited_coor=None): +
[docs]def depositInBox2D(radii, lx, ly, deposited_radii=None, deposited_coor=None): '''[nb_remaining_particles, coor]=depositInBox2D(radii, lx, ly, deposited_radii=None, deposited_coor=None): this function deposits circular particles in a box @@ -127,7 +127,7 @@ return [nb_remaining_particles, coor]
# fonction qui depose les particules dans un dique -
[docs]def depositInDisk2D(radii, r, deposited_radii=None, deposited_coor=None): +
[docs]def depositInDisk2D(radii, r, deposited_radii=None, deposited_coor=None): '''[nb_remaining_particles, coor]=depositInDisk2D(radii, r, deposited_radii=None, deposited_coor=None): this function deposits circular particles in a circular container @@ -180,7 +180,7 @@ # fonction qui depose les particules dans un "cylindre", pour un cisaillement # de Couette -
[docs]def depositInCouette2D(radii, rint, rext, deposited_radii=None, deposited_coor=None): +
[docs]def depositInCouette2D(radii, rint, rext, deposited_radii=None, deposited_coor=None): '''[nb_remaining_particles, coor]=depositInCouetteD(radii, rint, rext, deposited_radii=None, deposited_coor=None): this function deposits circular particles in container designed for a Couette shear @@ -227,10 +227,11 @@ # on definit un contour circulaire, de rayon rext et centre en [rext, rext] # N.B.: on definit dans un container legerement plus petit, pour eliminer les # les interpentrations avec le cylindre exterieur - slope_coor=numpy.zeros(160, 'd') - for i in xrange(0, 80, 1): + slope_coor=numpy.zeros(162, 'd') + for i in xrange(0, 81, 1): slope_coor[2*i]=rext + (rext - radius_max)*math.cos(math.pi*(1. - i*0.025)) slope_coor[2*i + 1]=rext + (rext - radius_max)*math.sin(math.pi*(1. - i*0.025)) + # on enleve les grains hors du contour nb_remaining_particles=lmgc90.cut2D_Cut(radii, coor, slope_coor) @@ -239,7 +240,7 @@ return [nb_remaining_particles, coor]
# fonction qui depose les particules de sorte a remplir un demi-tambour -
[docs]def depositInDrum2D(radii, r, deposited_radii=None, deposited_coor=None): +
[docs]def depositInDrum2D(radii, r, deposited_radii=None, deposited_coor=None): '''[nb_remaining_particles, coor]=depositInDrum2D(radii, deposited_radii=None, deposited_coor=None): this function deposits circular particles in the lower half part of a drum @@ -286,7 +287,7 @@ # on definit le contour a utiliser... slope_coor=numpy.zeros(84, 'd') - # ... en deux pertie : + # ... en deux parties : # - une ligne horizontale pour remplir a moitie slope_coor[0]=radius_max slope_coor[1]=r @@ -313,8 +314,8 @@ \ No newline at end of file diff --git a/docs/Pre/_modules/pylmgc90/pre/build_avatar/tools/containers3D.html b/docs/Pre/_modules/pylmgc90/pre/build_avatar/tools/containers3D.html new file mode 100644 index 0000000000000000000000000000000000000000..95b10220f9706009ef1d150fef038f5d646dc2ee --- /dev/null +++ b/docs/Pre/_modules/pylmgc90/pre/build_avatar/tools/containers3D.html @@ -0,0 +1,283 @@ + + + + + + + + pylmgc90.pre.build_avatar.tools.containers3D — pylmgc90.pre 2015.2 documentation + + + + + + + + + + + + + + +
+
+
+
+ +

Source code for pylmgc90.pre.build_avatar.tools.containers3D

+# module fournissant des macros de depot dans des conteneurs predifnis
+
+# import du module permettant de savoir si on pourra importer les pre_tools
+from pylmgc90.pre.utilities.check_compiled_modules import *
+
+# import des des wrappers des anciens pre-processeurs pour les milieux granualaires
+
+# si on peut essayer d'importer le module pre_tools sans tout faire planter
+if import_lmgc90():
+   # on essaye
+   try:
+      from pylmgc90.chipy import lmgc90
+   except:
+      raise
+
+# fonction qui depose les particules dans une boite paralepipedique
+
[docs]def depositInBox3D(radii, lx, ly, lz, deposited_radii=None, deposited_coor=None, seed=None): + '''[nb_remaining_particles, coor]=depositInBox3D(radii, lx, ly, lz, deposited_radii=None, deposited_coor=None): + + this function deposits spherical particles in a box + + parameters: + + - radii: radii of the particles + - lx: width of the box, following Ox axis + - ly: width of the box, following Oy axis + - lz: heigth of the box + + N.B. a point (x, y, z) is in the box iff x is in [-lx/2, lx/2], y is in [-ly/2, ly/2] and z is in [0, lz] + + optional parameters: + + - deposited_radii=None: radii of particles supposed to be already deposited + - deposited_coor=None: coordinates of these deposited particles + - seed=None: an input seed to control randomness + + returned values: + + - nb_remaining_particles: number of deposited particles + - coor: coordinates of the deposited particles [x1, y1, z1, x2, y2, z2, ...] + + WARNING: this function changes the radii list since it nullifies radii of the + particles out of the box. So, after calling this function, only the + first nb_remaining_particles particles are of interest''' + + # on recupere le nombre de grains + nb_particles=len(radii) + + # on depose les grains sous gravite dans la boite : + # l'appel varie en fonction de la presence ou non de particules deja deposees + if deposited_radii == None and deposited_coor == None: # cas sans particules + if seed is not None: + nb_comp_particles, coor=lmgc90.deposit3D_Box(radii, lx, ly, lz, 3*nb_particles, seed) + else: + nb_comp_particles, coor=lmgc90.deposit3D_Box(radii, lx, ly, lz, 3*nb_particles) + + elif deposited_radii != None and deposited_coor != None: # cas avec particules + # deja deposees + if seed is not None: + nb_comp_particles, coor=lmgc90.deposit3D_HeterogeneousBox(radii, lx, ly, lz, + deposited_radii, + deposited_coor, + 3*nb_particles, seed) + else: + nb_comp_particles, coor=lmgc90.deposit3D_HeterogeneousBox(radii, lx, ly, lz, + deposited_radii, + deposited_coor, + 3*nb_particles) + + else: # cas mal defini + showError('to compute a deposit involving already deposited particles, radii AND coordinates of the deposited particles!') + + # on renvoie le nombre de particules deposees par l'algorithme et leur + # coordonnees + return [nb_comp_particles, coor]
+ +# fonction qui depose les particules dans une boite cylindrique +
[docs]def depositInCylinder3D(radii, R, lz, deposited_radii=None, deposited_coor=None, seed=None): + '''[nb_remaining_particles, coor]=depositInCylinder3D(radii, R, lz, deposited_radii=None, deposited_coor=None, seed=None): + + this function deposits spherical particles in a cylinder + + parameters: + + - radii: radii of the particles + - R: radius of the cylinder + - lz: heigth of the cylinder + + N.B. a point (x, y, z) is in the cylinder iff x^2 + y^2 is in [0, R^2] and z is in [0, lz] + + optional parameters: + + - deposited_radii=None: radii of particles supposed to be already deposited + - deposited_coor=None: coordinates of these deposited particles + - seed=None: an input seed to control randomness + + returned values: + + - nb_remaining_particles: number of deposited particles + - coor: coordinates of the deposited particles [x1, y1, z1, x2, y2, z2, ...] + + WARNING: this function changes the radii list since it nullifies radii of the + particles out of the box. So, after calling this function, only the + first nb_remaining_particles particles are of interest''' + + # on recupere le nombre de grains + nb_particles=len(radii) + # on depose les grains sous gravite dans le cylindre : + # l'appel varie en fonction de la presence ou non de particules deja deposees + if deposited_radii == None and deposited_coor == None: # cas sans particules + if seed is not None: + nb_comp_particles, coor=lmgc90.deposit3D_Cylinder(radii, R, lz, 3*nb_particles, seed) + else: + nb_comp_particles, coor=lmgc90.deposit3D_Cylinder(radii, R, lz, 3*nb_particles) + + elif deposited_radii != None and deposited_coor != None: # cas avec particules + # deja deposees + if seed is not None: + nb_comp_particles, coor=lmgc90.deposit3D_HeterogeneousCylinder(radii, R, lz, + deposited_radii, + deposited_coor, + 3*nb_particles, seed) + else: + nb_comp_particles, coor=lmgc90.deposit3D_HeterogeneousCylinder(radii, R, lz, + deposited_radii, + deposited_coor, + 3*nb_particles) + else: # cas mal defini + showError('to compute a deposit involving already deposited particles, radii AND coordinates of the deposited particles!') + + # on renvoie le nombre de particules deposees par l'algorithme et leur + # coordonnees + return [nb_comp_particles, coor]
+ +# fonction qui depose les particules dans une boite spherique +
[docs]def depositInSphere3D(radii, R, center, deposited_radii=None, deposited_coor=None, seed=None): + '''[nb_remaining_particles, coor]=depositInSphere3D(radii, R, center, deposited_radii=None, deposited_coor=None, seed=None): + + this function deposits spherical particles in a cylinder + + parameters: + + - radii: radii of the particles + - R: radius of the sphere + - center: center of the sphere + + N.B. a point (x, y, z) is in the sphere iff (x - x_C)^2 + (y - y_C)^2 + (z - z_C)^2 is in [0, R^2] + + optional parameters: + + - deposited_radii=None: radii of particles supposed to be already deposited + - deposited_coor=None: coordinates of these deposited particles + - seed=None: an input seed to control randomness + + returned values: + + - nb_remaining_particles: number of deposited particles + - coor: coordinates of the deposited particles [x1, y1, z1, x2, y2, z2, ...] + + WARNING: this function changes the radii list since it nullifies radii of the + particles out of the box. So, after calling this function, only the + first nb_remaining_particles particles are of interest''' + + # on recupere le nombre de grains + nb_particles=len(radii) + + # on depose les grains sous gravite dans la sphere : + # l'appel varie en fonction de la presence ou non de particules deja deposees + if deposited_radii == None and deposited_coor == None: # cas sans particules + if seed is not None: + nb_comp_particles, coor=lmgc90.deposit3D_Sphere(radii, R, center, 3*nb_particles, seed) + else: + nb_comp_particles, coor=lmgc90.deposit3D_Sphere(radii, R, center, 3*nb_particles) + + elif deposited_radii != None and deposited_coor != None: # cas avec particules + # deja deposees + if seed is not None: + nb_comp_particles, coor=lmgc90.deposit3D_HeterogeneousSphere(radii, R, center, + deposited_radii, + deposited_coor, + 3*nb_particles, seed) + else: + nb_comp_particles, coor=lmgc90.deposit3D_HeterogeneousSphere(radii, R, center, + deposited_radii, + deposited_coor, + 3*nb_particles) + + else: # cas mal defini + showError('to compute a deposit involving already deposited particles, radii AND coordinates of the deposited particles!') + + # on renvoie le nombre de particules deposees par l'algorithme et leur + # coordonnees + return [nb_comp_particles, coor]
+ +
+ +
+
+
+ +
+
+ + + + \ No newline at end of file diff --git a/docs/Pre/_modules/pylmgc90/pre_lmgc/build_avatar/tools/granulometry.html b/docs/Pre/_modules/pylmgc90/pre/build_avatar/tools/granulometry.html similarity index 75% rename from docs/Pre/_modules/pylmgc90/pre_lmgc/build_avatar/tools/granulometry.html rename to docs/Pre/_modules/pylmgc90/pre/build_avatar/tools/granulometry.html index f18f6bf09dfd75448e366bb5224450fcc719853a..7380fde02275a3adcf914cbf8724215f61eab26a 100644 --- a/docs/Pre/_modules/pylmgc90/pre_lmgc/build_avatar/tools/granulometry.html +++ b/docs/Pre/_modules/pylmgc90/pre/build_avatar/tools/granulometry.html @@ -6,7 +6,7 @@ - pylmgc90.pre_lmgc.build_avatar.tools.granulometry — pylmgc90.pre 2015.2 documentation + pylmgc90.pre.build_avatar.tools.granulometry — pylmgc90.pre 2015.2 documentation @@ -46,7 +46,7 @@
-

Source code for pylmgc90.pre_lmgc.build_avatar.tools.granulometry

+  

Source code for pylmgc90.pre.build_avatar.tools.granulometry

 import math, numpy
 try:
   import scipy
@@ -54,27 +54,43 @@
 e