IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Fortran Discussion :

Combinaison du FORTRAN avec autres langages pour créer des graphes


Sujet :

Fortran

  1. #1
    Membre du Club
    Inscrit en
    Juin 2008
    Messages
    39
    Détails du profil
    Informations forums :
    Inscription : Juin 2008
    Messages : 39
    Points : 41
    Points
    41
    Par défaut Combinaison du FORTRAN avec autres langages pour créer des graphes
    Bonjour tout le monde;
    J’aimerai savoir est ce qu'il y a la possibilité de combiner le fortran avec le vb ou un autre langage pour créer l'interface de mon programme et pour générer des graphes

  2. #2
    Membre éclairé Avatar de genteur slayer
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juin 2002
    Messages
    710
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2002
    Messages : 710
    Points : 825
    Points
    825
    Par défaut
    depuis la norme 2003 de fortran on a un interopérabilité du fortran avec le C, encore accentué avec la norme 2008... de plus il est parfaitement possible de faire un link entre des objets C et fortran... tout comme avec d'autre language...
    si ce n'est que pour faire des graph, tu peux regarder la bibliotèque JAPI...
    il n'y a que ceux qui savent qui ne savent pas qu'ils savent...
    Libere-toi hacker, GNU's Not Unix!!!

  3. #3
    Membre du Club
    Inscrit en
    Juin 2008
    Messages
    39
    Détails du profil
    Informations forums :
    Inscription : Juin 2008
    Messages : 39
    Points : 41
    Points
    41
    Par défaut
    Merci d’abord pour vous,
    Bon votre réponse est claire mais lorsque vous disiez norme 2003 ou 2008 ca veut dire que je ne peux pas travailler avec le Compaq Visual fortran 2000 avec lequel je travail ????
    Personnellement j’aimerai bien travailler avec le VB6 (ou .net) pour créer à la fois mes interface et mes graphes

  4. #4
    Membre éclairé Avatar de genteur slayer
    Homme Profil pro
    Développeur informatique
    Inscrit en
    Juin 2002
    Messages
    710
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Rhône (Rhône Alpes)

    Informations professionnelles :
    Activité : Développeur informatique
    Secteur : High Tech - Éditeur de logiciels

    Informations forums :
    Inscription : Juin 2002
    Messages : 710
    Points : 825
    Points
    825
    Par défaut
    tu peux linker un peu tout les langage ensemble à partir du moment où les compilateurs respectifs utiliser un format d'objet compatibles...
    compaq visual fortran est aujourd'hui renommé en intel visual fortran...

    que dois-tu faire? reprendre un code existant ou démarrer un nouveau? si tu es dans le second cas, je te suggère avant toute chose d'allé chercher les dernières version de tous les outils (incluant, les environnement de développement de chaque langage, les compilateurs, le linker, les librairies, etc...) car l'interopérabilité des langage n'est pas encore établie à 100% et plus tu utilise une version récente plus tu aura des facilités!

    bon, visiblement tu veux utiliser 'visual', c'est un choix... regarde bien quel programme est utilisé comme linker, si c'est le même pourt fortran et pour VB, almors c'est gagné!!! il te suffira de faire quelques routines de conversion. ou bien de faire des librairies statiques que tu assemble au link...

    sinon et bien il y a toujours la solution des lib dynamiques (dll pour les intimes) avec quelques fonction d'interfaçage et hop!
    il n'y a que ceux qui savent qui ne savent pas qu'ils savent...
    Libere-toi hacker, GNU's Not Unix!!!

  5. #5
    Expert confirmé
    Inscrit en
    Avril 2008
    Messages
    2 564
    Détails du profil
    Informations personnelles :
    Âge : 64

    Informations forums :
    Inscription : Avril 2008
    Messages : 2 564
    Points : 4 441
    Points
    4 441
    Par défaut graphes ,visualisation
    conseil : change de compilateur Fortran vers SILVERFROST FNT95 PERSONAL qui integre plateforme .NET. IL est free(site:http://www.silverfrost.com/

    astuce 1: telecharge le controle visuel MS GLEE free
    site : http://research.microsoft.com

    astuce 2: telecharge l'API dedie aux graphes QUICKGRAPH free
    site :http://www.codeplex.com/

    ci-joint un exemple :
    -projet fortran (dll) pour lire les arcs d'un graphe
    -projet interface en vb.net :classe associe aux arcs du graphe
    -projet principal en vb.net :
    -> explore le graphe avec l'algo BFS(bread first search)
    -> affiche le graphe a l'aide du controle MS GLEE.


    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    C -Projet FNT95   (DLL FORTRAN)
    C  ----------------------------
    C- referencer Biblio  SALFLIB.DLL 
    C- referencer projet InterfaceVB
    C  ----------------------------
     
            SUBROUTINE Arcs(nomFichierArcVB,ArcVb,tblArcsVB)
    c       nom externe de la subroutine
            ASSEMBLY_INTERFACE(NAME="ArcsFor") 
     
    c       reference aux variables "interfaceVB" 
            OBJECT("System.String"),INTENT(IN):: nomFichierArcVB
            OBJECT("InterfaceVB.Arc") ,INTENT(OUT) :: ArcVb
            OBJECT("InterfaceVB.Arc[]"),INTENT(OUT) :: tblArcsVB
     
            IMPLICIT INTEGER (I-N)
    c       limite  maxi d'arcs de ce programme
            INTEGER :: LIMITARC
    c       compteur nombre  arcs lus
            INTEGER :: IARCLUS
    c       compteur
            INTEGER :: I
    c       longueur de l'arc
            REAL *4  :: lg(10)
    c       paires de tables des nom de noeuds
            CHARACTER*6 :: premNoeud(10),deuxNoeud(10) 
     
    c      initialisation       
            CLOSE(5)
            OPEN(5,FILE=char(nomFichierArcVB),STATUS='OLD')
            LIMITARC=10
     
     
    c       lecture de tous les arcs 
            IARCLUS=1
    100     CONTINUE
            READ(5,10100,ERR=110,END=250) premNoeud(IARCLUS),deuxNoeud(IARCLUS),lg(IARCLUS)
            IF(IARCLUS .LT. LIMITARC) GOTO 200
            GOTO 250
    110     STOP
     
    200     IARCLUS=IARCLUS+1
            GOTO 100
     
    c       renvoi les arcs à "VB"
    250     IARCLUS=IARCLUS-1
     
    c       initiliaze le tableau lstArcsVb à IARCLUS
            tblArcsVB=NEW@("InterfaceVB.Arc[]",IARCLUS)  
            DO 300  I =1,IARCLUS
    c       cree un objet ArcsVb
              ArcVb=NEW@("InterfaceVB.Arc")
              ArcVb%premNoeudVB=premNoeud(I)
              ArcVb%deuxNoeudVB=deuxNoeud(I)
              ArcVb%Longueur=lg(I)
    c       ajoute objet ArcsVb à table lstArcsVb(index base pour tableau VB est 0)
              tblArcsVB(I-1)=ArcVb
    300    CONTINUE
     
    10100  FORMAT(1x,A6,2x,A6,4x,F8.2)
           END SUBROUTINE Arcs
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    'projet InterfaceVB
    '-------------------
    '-namespace est "InterfaceVB" (voir projet Fortran)
     
    'classe Arc sert à stocker les arcs du programme fortran 
    Public Class Arc
        Public premNoeudVB, deuxNoeudVB As String
        Public Longueur As Double
     
        Public Sub New()
            Me.premNoeudVB = ""
            Me.deuxNoeudVB = ""
            Me.Longueur = 0.0
        End Sub
    End Class
     
    'projet principal frmGraphe
    '--------------------------
    '-ajouter un controle TextBox
    '-ajouter un controle Button
    '-ajouter un controle GVIEWER MS GLEE(selectionner : Microsoft.GLEE.Gviewer.dll) 
    '-referencer Microsoft.GLEE.dll,Microsoft.GLEE.DRAWING.dll
    '-referencer QUICKGRAPH.DLL , QUICKGRAPH.GLEE.DLL
    '-dependences : projet frmGraphe depend du projet InterfaceVB et du projet Fortran
    '-dependences : projet Fortran depend du projet InterfaceVB
    '-ordre de generation:InterfaceVB,projet Fortran,frmGraphe
     
    Option Explicit On
    Option Compare Text
    Imports System
    Imports System.Globalization
    Imports System.Threading
    Imports System.Windows
    Imports System.Collections
    Imports System.Drawing
    'Microsoft GLEE
    Imports Microsoft
    Imports Microsoft.Glee
    Imports Microsoft.Glee.GleeGraph
    Imports Microsoft.Glee.Drawing
    Imports Microsoft.Glee.GraphViewerGdi
    Imports Microsoft.Glee.Splines
    Imports Microsoft.Glee.DataBase
    Imports Microsoft.Glee.NativeMethods
    'QuickGraph
    Imports QuickGraph
    Imports Algo_Extension = QuickGraph.Algorithms.AlgorithmExtensions
    Imports Algo_PredObservSommetEnreg = QuickGraph.Algorithms.Observers.VertexPredecessorRecorderObserver(Of String, QuickGraph.Edge(Of String))
    Imports Algo_SommetDistObservEnreg = QuickGraph.Algorithms.Observers.VertexDistanceRecorderObserver(Of String, QuickGraph.Edge(Of String))
    Imports BFS = QuickGraph.Algorithms.Search.BreadthFirstSearchAlgorithm(Of String, QuickGraph.Edge(Of String))
    Imports Algo_PredObservArcEnreg = QuickGraph.Algorithms.Observers.EdgeRecorderObserver(Of String, QuickGraph.Edge(Of String))
    Imports Algo_Connexite = QuickGraph.Algorithms.ConnectedComponents.StronglyConnectedComponentsAlgorithm(Of String, QuickGraph.Edge(Of String))
    ' QuickGraph.Glee(pour methodes d'extension)
    Imports QuickGraph.Glee
    Imports InterfaceVB
    Imports FortrLib
    Public Class frmGraphe
     
        'Variables  pour appel a subroutine fortran
        '------------------------------------------
        Public lstArcs() As Arc
        Public monArc As Arc
     
        'declare  un graphe d'adjacence simple
        Dim monGraph As AdjacencyGraph(Of String, Edge(Of String))
     
        'Gestion du Graphe
        '-----------------
        'declare   "ArcGraph" de type QUICKGRAPH
        Dim ArcGraph As QuickGraph.Edge(Of String)
        'declare variable  "cout Arc"  de type Dictionnaire (ArcGraph,longueur)
        Dim edgeCost As Dictionary(Of Edge(Of String), Double)
     
        'Exploration du graphe
        '--------------------
        ' declare Algorithme type "BFS"
        Dim monBFS As BFS
     
        ' declare  "sommet Observateur" (chemin d'exploration sommet)
        Dim predecessorObserverSommet As Algo_PredObservSommetEnreg = New Algo_PredObservSommetEnreg()
     
        'declare  "arc Observateur" (chemin d'exploration arc)
        Dim predecessorObserverArc As Algo_PredObservArcEnreg = New Algo_PredObservArcEnreg()
     
        'declare  "Observateur Distance" pour avoir la longueur du   chemin explore
        Dim distObserver As Algo_SommetDistObservEnreg
     
        'Interface Graphique
        '-------------------
        'declare "Schema Visuel"  de type MS GLEE
        Dim schemaVisuel As Microsoft.Glee.Drawing.Graph
        Public Sub New()
            ' Cet appel est requis par le Concepteur Windows Form.
            InitializeComponent()
     
            ' Ajoutez une initialisation quelconque après l'appel InitializeComponent()
        End Sub
        Private Sub btnFichierArcs_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnFichierArcs.Click
            Dim nomFichierArcs As String = ""
            Dim dlgOuvreFichier As OpenFileDialog = New OpenFileDialog
            dlgOuvreFichier.Filter = "Fichier Arcs(*.txt)|*.txt"
            If dlgOuvreFichier.ShowDialog = Forms.DialogResult.OK Then
                nomFichierArcs = dlgOuvreFichier.SafeFileName
                If Len(nomFichierArcs) = 0 Then
                    MessageBox.Show("entrer un nom de fichier svp...")
                    Exit Sub
                Else
                    Call AfficheGraph(nomFichierArcs)
                End If
            End If
     
        End Sub
        Sub AfficheGraph(ByVal nomFichierArcs As String)
            ' Lit les arcs  avec dll fortran
            Call FortrLib.ArcsFor(nomFichierArcs, monArc, lstArcs)
     
            'Peuple  le "graphe simple " à partir des donnes arcs
            monGraph = New AdjacencyGraph(Of String, Edge(Of String))
            edgeCost = New Dictionary(Of Edge(Of String), Double)(monGraph.EdgeCount)
            Call Peupler_Graphe(monGraph)
     
            'Initiliase  Algo BFS 
            monBFS = New BFS(monGraph)
            predecessorObserverSommet.Attach(monBFS)
            predecessorObserverArc.Attach(monBFS)
            distObserver = New Algo_SommetDistObservEnreg(Algo_Extension.GetIndexer(edgeCost))
            distObserver.Attach(monBFS)
            'Execute Algo "BFS" avec  noeud "SOURCE" comme racine
            monBFS.Compute("SOURCE")
     
            'declare evenements noeudAjoute and  arcAjoute
            Dim noeudAjoute As New QuickGraph.Glee.GleeVertexNodeEventHandler(Of String)(AddressOf populator_NodeAdded)
            Dim arcAjoute As New QuickGraph.Glee.GleeEdgeEventHandler(Of String, Edge(Of String))(AddressOf populator_EdgeAdded)
     
            Dim populator As QuickGraph.Glee.GleeGraphPopulator(Of String, QuickGraph.Edge(Of String)) = _
            GleeGraphExtensions.CreateGleePopulator(monGraph)
            populator.Compute()
     
            'Obtient le graphe pour le controle MS GLEE
            schemaVisuel = populator.VisitedGraph.ToGleeGraph(noeudAjoute, arcAjoute)
     
            'Affiche Noeuds et Arcs du Chemin BFS
            Call AfficheCheminGraphVisite()
     
            'Presentation Graphique
            'Activation Options de Sauvegarde & Scroll
            GViewer_BFS.SaveButtonVisible = True
            GViewer_BFS.AutoScroll = True
     
            'Affiche le "schemaVisuel" dans le control MS GLEE
            GViewer_BFS.Graph = schemaVisuel
        End Sub
        Sub Peupler_Graphe(ByVal GraphCourant As AdjacencyGraph(Of String, Edge(Of String)))
            For Each elem As Arc In lstArcs
                'Ajoute Sommets et Arcs au graphe
                ArcGraph = New QuickGraph.Edge(Of String)(elem.premNoeudVB, elem.deuxNoeudVB)
                GraphCourant.AddVerticesAndEdge(ArcGraph)
                'Ajoute "cout arc" Fonction Dictionnaire "edgeCost"
                edgeCost.Add(ArcGraph, Double.Parse(elem.Longueur))
            Next
        End Sub
        Sub populator_NodeAdded(ByVal sender As Object, ByVal e As QuickGraph.Glee.GleeVertexEventArgs(Of String))
            Dim NoeudStyle As New Microsoft.Glee.Drawing.Style
            NoeudStyle = Microsoft.Glee.Drawing.Style.Rounded
            Dim nomNoeud As String
            nomNoeud = e.Vertex
            If nomNoeud = "SOURCE" Then
                e.Node.Attr.Color = Microsoft.Glee.Drawing.Color.Black
                e.Node.Attr.Fillcolor = Microsoft.Glee.Drawing.Color.Yellow
                e.Node.Attr.LineWidth = 2.0
                e.Node.Attr.Shape = Microsoft.Glee.Drawing.Shape.Box
                e.Node.Attr.AddStyle(NoeudStyle)
                e.Node.Attr.FontName = "VERDANA"
                e.Node.Attr.Fontcolor = Microsoft.Glee.Drawing.Color.Red
                e.Node.Attr.FontName = "Arial"
                e.Node.Attr.Fontsize = 10
                e.Node.Attr.Label = "Racine: " & nomNoeud
            Else
                e.Node.Attr.Color = Microsoft.Glee.Drawing.Color.Black
                e.Node.Attr.Fillcolor = Microsoft.Glee.Drawing.Color.GreenYellow
                e.Node.Attr.LineWidth = 1.0
                e.Node.Attr.Shape = Microsoft.Glee.Drawing.Shape.Box
                e.Node.Attr.AddStyle(NoeudStyle)
                e.Node.Attr.Fontcolor = Microsoft.Glee.Drawing.Color.Black
                e.Node.Attr.FontName = "Times New Roman"
                e.Node.Attr.Fontsize = 8
                e.Node.Attr.Label = nomNoeud
            End If
        End Sub
        Sub populator_EdgeAdded(ByVal sender As Object, ByVal e As QuickGraph.Glee.GleeEdgeEventArgs(Of String, Edge(Of String)))
            Dim ArcStyle As New Microsoft.Glee.Drawing.Style
            ArcStyle = Microsoft.Glee.Drawing.Style.Solid
     
            Dim Arc As Microsoft.Glee.Drawing.Edge
            Arc = e.GEdge
            Arc.Attr.Color = Microsoft.Glee.Drawing.Color.Blue
            Arc.Attr.LineWidth = 1.0
            Arc.Attr.AddStyle(ArcStyle)
            ArcStyle = Microsoft.Glee.Drawing.Style.Dashed
            Arc.Attr.AddStyle(ArcStyle)
            Arc.Attr.FontName = "Verdana"
            Arc.Attr.Fontsize = 8
            Arc.Attr.Fontcolor = Microsoft.Glee.Drawing.Color.Red
            Arc.Attr.Label = "non visite"
            'Si  Arc dans  predecessorObserverArc Changer Couleur("arc dans arbre BFS explore")
            If predecessorObserverArc.Edges.Contains(e.Edge) Then
                Arc.Attr.Color = Microsoft.Glee.Drawing.Color.Red
                Arc.Attr.ClearStyles()
                ArcStyle = Microsoft.Glee.Drawing.Style.Solid
                Arc.Attr.AddStyle(ArcStyle)
                Arc.Attr.LineWidth = 3.0
                Arc.Attr.Label = "visite :" & Format(edgeCost(e.Edge), "000.00")
            End If
     
        End Sub
        Sub AfficheCheminGraphVisite()
            'compte  Noeuds et Arcs du "graphe visite" 
            TextBox1.ForeColor = System.Drawing.Color.Red
            TextBox1.Font = New Font("courier new", 10, FontStyle.Bold)
            TextBox1.Text = "nombre Noeuds :" & (predecessorObserverSommet.VertexPredecessors.Count + 1).ToString & vbCrLf & vbCrLf
            TextBox1.Text = TextBox1.Text & "nombre Arcs :" & (predecessorObserverArc.Edges.Count).ToString & vbCrLf & vbCrLf
            'affiche  Liste  des "arcs visites"
            For Each CheminArc In predecessorObserverArc.Edges
                TextBox1.Text = TextBox1.Text & CheminArc.Source & " -" & CheminArc.Target & vbCrLf
            Next
        End Sub
    End Class
    donnees du fichier texte(villes.txt) :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    SOURCE  VILLE2    00045.15
     SOURCE  VILLE3    00045.15
     VILLE4  VILLE3    00045.15
     VILLE3  VILLE1    00045.15
     VILLE2  VILLE5    00045.15
     VILLE5  VILLE4    00045.15
    CI-JOINT LE PROJET SOURCE
    Pièce jointe 67668

    Pièce jointe 67669

Discussions similaires

  1. [jpGraph] Problème pour créer des graphes
    Par kensem dans le forum EDI, CMS, Outils, Scripts et API
    Réponses: 1
    Dernier message: 03/12/2011, 14h51
  2. librairie pour créer des graphes
    Par hogan dans le forum Windows Forms
    Réponses: 7
    Dernier message: 25/08/2009, 16h14
  3. Langage pour créer un programme sans runtime ?
    Par thebeb dans le forum Windows
    Réponses: 5
    Dernier message: 27/08/2006, 18h24
  4. Le meilleur langage pour créer des jeux ?
    Par fourgeaud dans le forum Langages de programmation
    Réponses: 14
    Dernier message: 15/09/2005, 13h41
  5. quel langage pour créer des "applications" sur 1 s
    Par jaribu dans le forum Langages de programmation
    Réponses: 7
    Dernier message: 30/07/2003, 14h06

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo