I just added this subroutine to my FE generator. It reads the file, but the fifth line is not read causing an error. ID(5,1) is incorrect.
I checked the textfile in VEDIT, EXCEL and NOTEPAD++, it appears ok.
I pulled the code out and put it into this console program and it still misses.
No idea what I have done wrong.
! Console2.f90
!
! FUNCTIONS:
! Console2 - Entry point of console application.
!
!****************************************************************************
!
! PROGRAM: Console2
!
! PURPOSE: Entry point for the console application.
!
!****************************************************************************
program Console2
implicit none
Integer M,N
Integer ID(12,20), ID1(12),I,J
M = 12
N = 20
open(25,file = "Element20.txt",STATUS= "OLD")
do 1 I = 1, M
read(25,*)ID1(I),(ID(I,j),j=1,N)
1 end do
print *, 'Hello World'
end program Console2
链接已复制
If you do this a lot, such may help
using namespace System;
using namespace System::IO;
int main(array<System::String ^> ^args){
//String^ sF = "d:\\c\\vs2022\\fConsole20\\Console20\\Element20err.txt";
String^ sF = "d:\\c\\vs2022\\fConsole20\\Console20\\Element20.txt";
StreamReader^ SR = gcnew StreamReader(sF);
String^ sf = SR->ReadToEnd();
SR->Close();
array <Char>^ ac = gcnew array <Char>(1) { ('\n') };
array<String^>^ as_n = sf->Split( ac, StringSplitOptions::RemoveEmptyEntries);
//array<String^>^ as_n = sf->Split(ac, StringSplitOptions::None);//catch "...,,..."
array<int>^ ai = gcnew array<int>(as_n->Length);
ac[0] = ',';
for (int i = 0; i < as_n->Length; i++) {
array <String^>^ asx = as_n[i]->Split(ac, StringSplitOptions::RemoveEmptyEntries);
ai[i] = asx->Length;
}
return 0;
}
@MWind2 , thanks. Yes, one can do something similar in C#. I was just lazy, I should have realized there was a mistake in the numbers sooner, but it was a bulk copy from Stand7 to EXCEL and then into VS Editor, strange how one entry in the middle of the entries got lost.
It is a 70 mm rod buried in concrete blocks. It is easy to create beams with 100 mm cubes in Fortran and read them into Strand7, much better than any other method of quickly generating models that are not filled with random 3D polygons that one cannot check. it has 119 nodes and 12 elements. Now to add correct properties. Luckily most engineers in metric use round 100 mm numbers.