Programming :: Calling Fortran 95 Code In C?

Apr 15, 2009

I'm trying to call some Fortran 95 code in C, but I'm having problems with integers not having the same value in C as in Fortran, and changing values upon each run of the program. I think it has to do with the integer type, but I don't know how to fix it. I'm running Gentoo x86. Here are the files I've got:

foo.c:

Code:

#include <stdio.h>
extern int qux_();
main() {

[code]....

View 2 Replies


ADVERTISEMENT

Programming :: Calling Routines In Fortran Modules From C++?

Jan 21, 2011

I want to call a subroutine in Fortran 90 from a c++ code. I can do it, when the fortran code have no module. But i need to call the subroutine in a fortran code that have an module. I have a simple program that shows my problem. The Fortran code is:

Code: !add2.f90
Module add2
Implicit none
Contains

[code]....

collect2: ld returned 1 exit status I Dont know where is the problem. Maybe it is in the call of the function. I found that the syntax have this form: extern void __namemodule__NMOD_namesubrutine(arg)

View 6 Replies View Related

Programming :: C++ Program Calling A Fortran Subroutine With A Function In The Argument?

Mar 9, 2011

I have a new problem; i want to call a subroutine's fortran which have a function in the argument and the compilation ran properly, but when i execute the program this shows me an "Segmentation fault". This is my c++ program:

Code: //Main.cpp
#include <stdio.h>
#include <iostream>

[code]....

View 2 Replies View Related

Programming :: Fortran Code On 32/64bit Machine

Jun 10, 2009

I'm not a Fortran coder but I need to call the sub-routine ADAPT.f from a c code.This subroutine calculates a multiple integral of a given function.My problem is that the c code works with no problem in a 32 bit machine but it does not in a 64 bit machine, and the problem seems to be related to adapt, which calculations gives a NA rather than the result of integration.Since fortran is quite obscure for me, I don't know why is this happening. Maybe I should change some data type (from real to double), but I'm not sure. Does anyone have a clue?

View 3 Replies View Related

Programming :: Fortran 90 Code - Makefile Insensitive To Change

Mar 10, 2011

I am dealing with one FORTRAN 90 code, have made small changes.

milenko@milenkons:~/mt4$ make mt4
make: 'mt4' is up to date.
milenko@milenkons:~/mt4$ ifort -c MT2DDIB1.FOR
milenko@milenkons:~/mt4$ make mt4
make: 'mt4' is up to date.
milenko@milenkons:~/mt4$ make mt4
make: 'mt4' is up to date.
milenko@milenkons:~/mt4$ make mt4
make: 'mt4' is up to date.

I go for make command but it does not see that the source code has been modified.Than I do compilation from command line,try make again but no use.
F95=ifort
FFLAFGS= -O1

mt3: driver_mt2ddi.o constants.o settings.o params.o mt2dmod.o fdsystem.o mt2ddat.o mt2dsens.o
$(F95) -o $(FFLAGS) mt3 constants.o settings.o params.o mt2dmod.o fdsystem.o mt2ddat.o mt2dsens.o driver_mt2ddi.o
driver_mt2ddi.o: driver_mt2ddi.for constants.o settings.o params.o mt2dmod.o fdsystem.o mt2ddat.o mt2dsens.o
$(F95) -c $(FFLAGS) driver_mt2ddi.for

View 2 Replies View Related

Ubuntu :: Changing Fortran Code To Python?

Aug 19, 2011

I have a big fortran code for FE analysis. I want to change the code to python. I am curious to know, whether I will get any advantage over speed, If not at least the speed should not be less than what fortran gives. Should I go for it.

View 2 Replies View Related

General :: Compiling Fortran Code In SuSe 11.3

May 18, 2011

I can compile an old fortran program on my macbook using the Absoft fortran compiler and the command:f90 'W132 C SOURCECODE.flU77lV77

Unfortunately I cannot find f90 for linux. I can, however, find gfortran. However, gfortran does not recognize the flag -W132 and when I remove -W132 the compiler thinks all lines end after a certain number of characters. Does anyone know what flags call the equivalent type of compilation using gfortran? Is it possible I need to use f90? If so, is there a free version of f90 for linux?

View 8 Replies View Related

Ubuntu :: Fortran Syntax Highlighting And Code Folding Editor Wanted?

Jul 27, 2011

I am looking for a text editor that does 1) syntax highlighting2) code folding3) it would be a bonus if I could set which macros were defined and it would show me the source I have tried geany, and codeblocks. Both incorrectly code fold around preprocessor #ifdef and #endif. The gedit plugin doesn't seem to work at all

View 7 Replies View Related

General :: Write A Script To Execute A Fortran Code That Reads In Parameters From Keyboard Typing?

Apr 18, 2011

I am trying to write a script (especially C-shell) to execute a fortran code that reads in parameters from keyboard typing. I will have to process this .F code for many times with the parameters the same for all my data files, therefore, I don't have to type in everytime I execute the .F code. But I don't know what is the command in c shell to read in a text files that contains all the parameters I want and can make the shell read in appropriately to feed the .F code.

View 3 Replies View Related

Software :: Reading And Writing SAC (Seismic Analysis Code) Data Files In Fortran Codes

Dec 2, 2008

I synthesized a seismogram by using Fortran codes, I need plot the synthesized seismogram and the data together, so I can verify the accuracy of code. Now I encounter a question: how to read the SAC data by Fortran code, I have searched some codes on Internet, the details as follow:the velr12a.sac is my data file.

Code:
c read sac file
PROGRAM RSAC
PARAMETER (MAX=1000)
DIMENSION YARRAY(MAX)
CHARACTER*10 KNAME

[Code]....

View 2 Replies View Related

General :: Error Calling Get_folders: Launch Helper Exited With Unknown Return Code 1

Jul 18, 2010

hi..
I'm using ubuntu 10.04 and whenever i start nautilus from command line it shows error:

Code:
root@aduait-laptop:~/Desktop# nautilus
Initializing nautilus-gdu extension
** (nautilus:9990): WARNING **: Error calling get_folders: Launch helper exited with unknown return code 1
** (nautilus:9990): WARNING **: Error calling get_folders: Launch helper exited with unknown return code 1
** (nautilus:9990): WARNING **: Error calling get_folders: Launch helper exited with unknown return code 1
** (nautilus:9990): WARNING **: Error calling get_folders: Launch helper exited with unknown return code 1
** (nautilus:9990): WARNING **: Error calling get_folders: Launch helper exited with unknown return code 1

View 5 Replies View Related

Fedora X86/64bit :: Same Fortran Code, Different Results For 32 And 64bit System?

Jan 15, 2010

I have the simple fortran codes as:

Code:
integer :: i1=2455121, i2=2455121
real :: s1=0.19123840, s2=0.20749992
real*8 :: a1, a2
a1=i1+s1; a2=i2+s2

[Code]....

When s1 and s2 are stated with 'real*8', the 64bit and 32bit systems get the same results.

View 6 Replies View Related

Programming :: How To Call Fortran Subroutine From IDL

Sep 29, 2010

There are examples everywhere about calling f77 subroutine from IDL, but I have not found any material about IDL calling fortran written in f90 way(free style). I tried the following example, but write the subroutines in free style. When I run the makefile, it gives an error 'undefined reference to main_'.

Code:

SUBROUTINE SUM_ARRAY(argc, argv) !Called by IDL
INTEGER*4 argc, argv(*) !Argc and Argv are integers
j = LOC(argc) !Obtains the number of arguments (argc)

[code]....

View 1 Replies View Related

Programming :: Comparing Data In Array In FORTRAN?

May 16, 2010

I have two arrays of data, called data1.dat and data2.dat. each contains 60 data. What I want to do is to compare the data in each file and write the counting into bins. It goes like this. First, take the first data in data1.dat file and compare with the 60 data in data2.dat file. If there is any data which is same with the data in data1.dat then it count in bin. The total bins are also 60. Next it goes to the second data in data1.dat and compare with all the 60 data in data2.dat. If there is any data same then it add in second bin. And it repeats to all the data in data1.dat

View 3 Replies View Related

Programming :: Fortran How To Open A File In Loop

Jun 29, 2011

I have a 50 file name NSSAVE0001.vtk to NSSAVE0050.vtk.Do I have to manually type individually command to open each file or can I have a loop to open file?

View 3 Replies View Related

Programming :: Get An Error Using A Namelist In A Fortran 90 Program ?

Aug 26, 2010

I have a program which reads some parameters in from an input file before solving a differential equation. This program compiles fine, I'm using Numerical Algorithms Group (NAG) libraries to solve the differential equation so I'm also the NAG compiler called nagfor.

The namelist I have is declared as follows:

And the input file is:

When I run the code I get the following error message:

I really can't see what's wrong with this code.

Also, I'm using Fedora 11, and running the code in tcsh if this is relevant.

View 1 Replies View Related

Programming :: Generating Files With Different Names At Each Loop In Fortran?

Nov 7, 2010

I am trying to write a loop to open four main-data-files. At each open of the main-data-file, I want the loop to open another four sub-files and split the data from the mail-data-file according to the creteria and dump into the four files. When the loop goes to the second main-data-file, it shall generate another 4 sub-files with different file name. And the process goes on. That means I will have total of 16 sub files for the four main-data-files. Each four files from the 16 files shall have specific name on it. Based on the code which I given below, I would say when the file at UNIT=100 is opened, 4 new files needed to be opened as well. They are:

maximum_dist_001_064.dat
maximum_dist_065_128.dat
maximum_dist_129_192.dat
maximum_dist_193_256.dat

View 1 Replies View Related

Programming :: Fortran Program--encountered Run Time Error?

May 19, 2011

i am graduate student and my X colleague gave me this Fortran 77 program to run my result files with. She is no longer reachable. I compiled the following program with gfortran, it compiled well but, when i run it, gave me end of file error. My output file (which is the input file for this program (DFILE1) ) has about 78,000 lines of velocities of atoms (Vx, Vy, Vz with 1000 steps.. an example of some of the atom's velocities in the 1st step is given at the end of this program). I will be highly obliged if any one can help me with this.I run this program on opensuse linux 11.3 version /32 bit/i586

error message:

Code:
At line 124 of file v.autocorrelation.f (unit = 10, file = 'DFILE1')
Fortran runtime error: End of file

Code:
PROGRAM TCORR

COMMON / BLOCK1 / STORX, STORY, STORZ
COMMON / BLOCK2 / VX, VY, VZ
COMMON / BLOCK3 / VACF, ANORM
C *******************************************************************
code....

View 6 Replies View Related

Programming :: Local Dynamically Allocated Array In Fortran?

Oct 19, 2009

I (my friend) have a fortran program with the code along the following lines:

Code:

SUBROUTINE NY
REAL, DIMENSION(4000,4000) :: a, b, c
...
RETURN
END SUBROUTINE PARAMETERS

The problem is that the huge matrices are retained in memory even after the subroutine ends. Is there an easy way to declare the arrays in a sort of dynamic way, like they were in the following C example?

Code:

void ny(void) {
double a[4000,4000];
...
}

I mean in the C example the memory is released as soon ny() exits.

View 5 Replies View Related

Programming :: Calling An Asm Function From C?

Jun 4, 2010

I have a question about calling an asm function from C....It doesn't work unless I create an asm variable to hold the value of the function in....Why?Here's the code that doesn't work...

asmfile.s - version one Code: .section .data
mydata: .ascii "this is the message!
.equ mylen, . - mydata

[code]...

View 2 Replies View Related

Programming :: Calling C Function In Php?

Feb 7, 2011

I am doing a web site program and what I need is to call a C program in the PHP cloud.Do u think it would be possible? The web site would get the user input from PHP UI and pass to the C program , the C program would process the function with the user input and output the a PHP page.

View 2 Replies View Related

Programming :: Selenium Java Code Into Equivalent Php Code?

Mar 30, 2011

I need to rewrite the selenium java code into its equivalent php code.

View 5 Replies View Related

Programming :: Fortran - Array-valued Function Leads To Segfault?

Jun 8, 2010

I'm trying to implement a solver for a system of differential equations in Fortran. The solver contains a number of functions which are supposed take real values, 1D arrays of real values or both as arguments and return arrays of real numbers, all of which cause the program to segfault. Example:

Code:

function y_exakt(t)
implicit none
real::t, pi

[code]....

(the last number in the array seems to change randomly). Then the program crashes either when f(t,y) is called or when dy is returned (after removing the call to f). What could cause these (memory?) problems and/or what could I do to identify the problem? Increasing the maximum stack size with ulimit or compiling the program with -fno-automatic has had no effect. I'm using gfortran (gcc 4.4.3) on a 64-bit Ubuntu Lucid machine. The complete program can be found at [URL].

View 3 Replies View Related

Programming :: Fortran Runtime Error: Bad Value During Floating Point Read

Jun 28, 2011

I am getting error Fortran runtime error: Bad value during floating point read. How do I format negative sign?

[code]...

View 1 Replies View Related

Programming :: Put Blank Spaces In Between List Of Numbers Generated In FORTRAN?

Aug 25, 2010

I have two sets of data. 1,2,3,4 and 6,7,8 and I have written a fortran code to put them in order as below:

program gap
implicit none
integer:: i, j
do i = 1,4
do j = 6, 8

[Code]...

I want a space once every row loop has finish.I am dont know how to write the data as shown above using the fortran code in this post.

View 2 Replies View Related

Programming :: Save The Results Of A Fortran Loop In A Text File?

Nov 2, 2010

I am trying to store the results of my code to a separate text file.But the problem is, as my results comes from a loop, my text file shows only the last result, not all of them.Like if the loop runs 5 time the text file shows the result for the 5th step.But i need to store all of them (1 to 5).Can I use awk to print the output field and store to another file and creat a new line so that the next output field goes to a new line?(just an idea, dont know).

#!/bin/basth
for (( i=1; i<=5; i++))
do
./file.exe > output.txt
done

View 2 Replies View Related

Programming :: Calling C Ece From Java Source

Aug 13, 2010

I want to call c exe from java source code and i want to interact with the c program during it's execution, i am able to send the parameters to c program but i am not able to interact with it.

View 3 Replies View Related

Programming :: Tty Is Closed Without Calling Close(?)

Feb 17, 2011

I have found a weird behaviour on a linux application. A tty seems to get closed without calling close. The program is (very simplified) as follows:

Process 1:
configure_signals()
read_config_files()
create_threads()
wait(forever)

Thread 1:
fd=open(/dev/ttyXX)
usleep(a while)
config(fd)

I have spent quite a lot of time on this problem. It seems like the file is sometimes closed when reaching config(fd), but removing the usleep(a while) seems to remove the problem.

View 1 Replies View Related

Programming :: Calling Bash Script In Php?

Jul 17, 2010

I have a bash script that changes the iptables.Now i call this bash script in my php code.When this bash script is running the part of code that contains iptables instruction is not running because we need to be in superuser mode(root)

View 14 Replies View Related

Programming :: Calling Subroutine In Perl

Aug 19, 2010

What is the difference in perl between:

'function();'

and

'&function();'

with and without ampersand.

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved