Programming with C++ Free discussion
#11
George,

I agree, I find the programming side of these very interesting since it allows engineers to build applications specific to their requirements. I tried learning C/C++ a few times but I got little further then making a few trivial examples. I have a lot of respect for anyone who uses C++ effectively in an engineering office.

Python is slower on the runtime side of this for sure. *BUT*, there are python modules writen in C so you can speed up many parts of the codes. Maybe I should make a new subject so I dont hijack this thread. Would be very interest to hear what engineering projects you have undertaken in Python George. I am trying to learn wPython + OpenGL at present. I have a great interest in the subject and would love to discuss further with anyone intersted in the same.

Regards Elbarto
.
[-] The following 2 users say Thank You to elbarto_87 for this post:
  • george85, mecheil.edwar
Reply
#12
Hi Elbarto,

As a matter of fact I did not create any kind of engineering project in Python, neither I am fluent in it. Just few simple scripts. But I am planning to start learning it a bit more.
To make it even more strange, I am not even an engineer :)
Up until now I have been using something not that popular in engineering world - a visual programming language called Grasshopper:

***************************************
Content of this section is hidden, You must be registered and activate your account to see this content. See this link to read how you can remove this limitation:

http://forum.civilea.com/thread-27464.html
***************************************


Its abilities are far less the Python's still some nice things could be accomplished in it, without the knowledge of programming.
Here is an example of a Cold water supply design script I made in Grasshopper:

***************************************
Content of this section is hidden, You must be registered and activate your account to see this content. See this link to read how you can remove this limitation:

http://forum.civilea.com/thread-27464.html
***************************************


I do not know if I went too much into off topic, and maybe you are right about opening a new Thread.
Apologizes to the Moderators.
[-] The following 1 user says Thank You to george85 for this post:
  • mecheil.edwar
Reply
#13
For me whenever I try doing, whatever software, short or long I find it very difficult to successfully implement design patterns.
For example:
***************************************
Content of this section is hidden, You must be registered and activate your account to see this content. See this link to read how you can remove this limitation:

http://forum.civilea.com/thread-27464.html
***************************************

Or the classical 3 tier model-view-controller or model-view-presenter pattern.
***************************************
Content of this section is hidden, You must be registered and activate your account to see this content. See this link to read how you can remove this limitation:

http://forum.civilea.com/thread-27464.html
***************************************


In other words doing the software engineering/architecture I find it to be the most difficult and time consuming task.
Writing code, plain code doesn't seem to be the issue.

Many times whatever I write becomes after each line more and more tangled and after a while impossible to change, adapt, reuse.
If I go back to let's say a function or a part of it and wish to use it asynchronous or even multi-threaded, I have to rewrite a lot.

Adding more difficult to implement things like undo-redo or global error handling or messages, multiple language support or even testing just destroys the code.
Rewriting stuff from scratch is cumbersome after 3 or 4 attempts from nice to have it becomes too difficult to have.

I guess it's because I first learned pascal and basic and I got so used to the statement after statement programming style. One task one software, new task new software. A Rambo design pattern get in solve get out, fast, before it collapses.

In object-oriented programming let's say C#, abstract classes, proper inheritance, interfaces namespaces, assemblies, delegates, generics, structs all make my enthusiastic programming hobby a lot more difficult. At least I don't have to do memory handling too.
Sometimes I have the feeling I write what I need where it should be, but lesser I actually do and so a lot of disappointment. For me patterns have a trap, writing ton's of abstract useless stuff to describe a simple future maybe working object that I actually don't really need. Don't know why, maybe I lack experience or logic.

So I find completely not interesting the speed of an software written in a language, compiled by some compiler and used in a specific shared environment, on a specific machine with limited shared resources.
But the simple fact that I can change let's say application data storage from ram to disk and back as needed without changing a single line of code in controller or view is pretty much amazing. Doing so at runtime according to machine resources is more amazing.

The topic which is faster is old and new, everyone talks about it, not here, but on the web, all are doing benchmarks. Each time a new language and compiler is available everyone is testing it. Just google for c vs c++ vs fortran vs vb vs java vs ruby vs python vs assembler vs pascal vs delphi vs whatever.

For me knowing a language well and at least partially the behavior of compiled code will really make a difference.
In c# for example passing structs with ref will improve the speed a little, using dictionary instead of list will be very very fast for many tasks.
Making a custom collection type instead of publicly using the provided array/list or dictionary and hiding it, the storage implementation, will always allow me to change it after a proper profiling, memory and speed. The collection "pattern" will allow to store/retrieve in the future from database or network server ....

Python is great as a scripting language, at least that's what everyone is using it for.
I believe a good, complete, modern, programming environment needs language, compiler, tools, debugger and has to provide at least gui design, data communication, storage, in fact each tier of the MVC pattern.

Visual Studio 2012 or 2010 C# is so a nice experience to use, I wished word was that nice to use. Making use of UML diagrams makes life very easy.

At some point many of us decide to write a solver. It's a common practice.
Here are few thought's regarding speed:

TAUCS solvers (Sap2000 uses):
***************************************
Content of this section is hidden, You must be registered and activate your account to see this content. See this link to read how you can remove this limitation:

http://forum.civilea.com/thread-27464.html
***************************************


Math.NET Numerics which can use external MKL and ACML libraries
***************************************
Content of this section is hidden, You must be registered and activate your account to see this content. See this link to read how you can remove this limitation:

http://forum.civilea.com/thread-27464.html
***************************************


Or even a straight translation:
***************************************
Content of this section is hidden, You must be registered and activate your account to see this content. See this link to read how you can remove this limitation:

http://forum.civilea.com/thread-27464.html
***************************************


I'm not sure that time, money and will are enough to write something better.
If you have the time and pleasure have a look at "NONSAP A Structural Analysis Program", it was written in 1974.

So when I look back to most of what I wrote in the past 10 years I see these patterns:
***************************************
Content of this section is hidden, You must be registered and activate your account to see this content. See this link to read how you can remove this limitation:

http://forum.civilea.com/thread-27464.html
***************************************


My advice is to keep things simple and clear, reusable, editable, and spend as little time as possible, life's short. 10 sec is almost equal to 1 sec if it does work, gives no error, and can be improved by not rewriting it from scratch.

So use Visual Studio Grin if you need performance real performance use an already made tool.
[-] The following 7 users say Thank You to LiviuM for this post:
  • 3fan, george85, Dell_Brett, mecheil.edwar, melekeen, warbeast, foxxx2010
Reply
#14
Thanks Guys for these improvement

Now , I built few models By Using Win API 32 By Using C++ Codes..

I learnt some points for OpenGL .. it is very easy ..

The Propblem Between OpenGL & Win API , when I try to build user interface to implement WIN API Icons and OpenGL it is little bit difficult..

OpenGL is very nice and very easy to build Graphic Applications..
Weak Point with OpenGL .. it is not supported By Microsoft..

So Now , Again I have to Learn DirectX ..
I have two issues I feel that I have to understand
-COM
-DLL

I try to understand COM , at least to know how can I build DirectX code..
Some Saying it is not required ..I think so.. But at least to have good understanding to use directX.. you need to know how COM is working ..and you need to know some thing about DLL (Dynamic Link Library files)

What I understood during this period is ..
- you have mathimatical operations to do by proccessor .. this is normal codes
- you have Screen Device to show your outputs on screen..
to control every Pixel on Screen you have to use DirectX or OpenGL
Win API can control Screen (Sure) .. But it is very Slow for graphic Programming

The Latest news that I heared that
Windows 8 is not supporting OpenGL , is true or not I do not know..
But in this case some softwares will not work nicely with Win 8 ( Archicad as example)

My Best Regards for all who contribute this discusion...
[-] The following 1 user says Thank You to mecheil.edwar for this post:
  • LiviuM
Reply
#15
(04-09-2013, 09:28 AM)mecheil.edwar Wrote: Windows 8 is not supporting OpenGL , is true or not I do not know..

Thanks for heads up Mecheil. I just brought a new laptop. It has windows 8 and high resolution screen. I immediately downgraded to windows 7 as I don't think many engineering companies will enjoy window 8 for the type of work we will do. I cant see any benefits to us as engineers using the new 'Metro' interfaces. Cant imagine anyone ever wanting to build a frame model using an iPad or similar :) . Ps. The high res screen was a poor choice for a machine to develop GUI's on.

Thanks for posting back with your progress.

Regards Elbarto
.
[-] The following 1 user says Thank You to elbarto_87 for this post:
  • mecheil.edwar
Reply
#16
@ mecheil.edwar

Welcome in programing world. I think you are little bit confused and it is normal to be in the beginning. You are missed some things and I will try to give you some explanations.
First, the mathematical calculations can be done in CPU (central processing unit) or in GPU (graphics processing unit).

Win API graphical library is slow because it does not support hardware acceleration which is supported by OpenGL and DirectX libraries.

I suggest you to use OpenGlL because your application will be portable (it will work under Linux). OpebGL is delivered by video card drivers and it has to be supported by Window 8 and any next window version.

About the COM: named as Component Object Model and it is is a binary programming standard. Usually you do not need COM because you will not use it at all.
DLL or Dynamic Link Library is the same code but instead to be linked in EXE it is linked in DLL.
In this way you can write the code once and you can access the methods by many external applications.

Hope I managed to clear you some unknowns and I wish you success in being a software developer.

My last advice is that you are not a software programmer and you do not need to know C++, because you can loose much time to learn it and you will not have much benefit of it.
Try to use much friendly language such as Matlab, VB.Net or C#.

Igor
[-] The following 2 users say Thank You to igor1234 for this post:
  • mecheil.edwar, LiviuM
Reply
#17
Quote:Windows 8 is not supporting OpenGL , is true or not I do not know..

I have win 8 and I can run OpenGL apps, it's working like it should FEM software, old software, my software, haven't tried games though.

Windows 8 for desktop, x86/x64 processor has support for OpenGL the graphics cards have drivers for win 8 and for OpenGL.

If you don't know Nvidia or ATI or ... pay to SGI for each driver they make with opengl this is why you, developer, can use the api for free. This has never changed in time while DirectX policy can change whenever Microsoft wishes. So...

It is said the win 8 ARM edition has no support for OpenGL.
Win 8 ARM processor edition is for expensive toys phones, hand helds, ebooks, pads, clocks, TV, car, and whatever technology that looks fancy, looks like a computer has multicore and lots of ram but it's definitely not a computer.

So if you write app's for IPhone, IPad, Android which is like 90%..98% of the market you'll be ok OpenGL ES only, if you write app's for the windows ARM products the other 10%..2% of the market you have to use directx.
Google search for: windows mobile market share pie chart
***************************************
Content of this section is hidden, You must be registered and activate your account to see this content. See this link to read how you can remove this limitation:

http://forum.civilea.com/thread-27464.html
***************************************


There was hysteria when Vista came up, No OpenGL SadSad, I guess nobody wishes to leave Microsoft full (license) freedom for graphics hardware API.

Here more talking about this:
***************************************
Content of this section is hidden, You must be registered and activate your account to see this content. See this link to read how you can remove this limitation:

http://forum.civilea.com/thread-27464.html
***************************************


You should think also about how many technologies were developed by Microsoft and abandoned, learning those would have proven wrong (like XNA). I guess Microsoft is not a stable provider of api or license.
[-] The following 3 users say Thank You to LiviuM for this post:
  • Dell_Brett, 3fan, mecheil.edwar
Reply
#18
(04-09-2013, 06:51 PM)igor1234 Wrote: My last advice is that you are not a software programmer and you do not need to know C++, because you can loose much time to learn it and you will not have much benefit of it.
Try to use much friendly language such as Matlab, VB.Net or C#.
Igor

Thanks Igor for your effective comments ..
and Let me say something ..I am very familer with C++ and Pointers give me a better understanding for what is running inside PC.. Littel Bit ..

And I have one specific question if you can answer me...
I try to Buld windows Frame by Win API ..It is Ok I used GDI and win API function to build this frame and I added Icons ( Dialoge Box ,Buttons , Edit Boxes..)
It was working very good..
But When Itry to add OpenGL frame inside Window frame .. when I try to move or increase the size of frame I loss the Shape that drawn by OpenGL ...
To Imagine what I am Saying .. Assume I have Some thing Like Pain program..
The frame of program is divide into two Parts ..
the Drawaing area is controled by OpenGL.. any shape will be drawn by OpenGL control.
The Other Part of frame ..I mean Buttons ,input boxes .. etc will be dialoge .. this by Win API..
this is my Application ..and The problem will happen if |I try to move frame or changer Size of frame..in this case I loss the shape that I draw by OpenGL...

I hope you and our collegues some solutions
Reply
#19
Dear mecheil.edwar,

I don't get it. Can't you just copy paste from an existing OpenGL control. I guess there are hundreds successful implementations.
There's Tekla Structures which works in all windows x86/x64, it is using Opengl, it is written in C++, it uses windows api and microsoft controls.
There's also Autocad the older versions before they switched to Directx. Or even Sap2000 versions before version 15.

I mean if others "don't loose shapes", it can be done, how hard is it, depends on what direction you're heading to. If you wish the hard way keep doing it the hard way Grin.

I have recently played with sharpgl wrapper and I can put controls over it just like that, people say it's not recommended to mess up with the context surface/window/control but you can and it works.
Try it all you have to do is to download visual studio express and sharpgl install them, add reference to it in a forms project draw the control on the form, draw some other controls there and there you go it's working Happy, in xp, vista, 7 and 8 x86/x64. It doesn't take more than an hour for the whole thing.

In the debate DirectX vs OpenGL there should be no winner.
Think like this, in a successful software developing company theres one guy who knows win api, one guy who knows OpenGL, one guy who knows DirectX, on guy who makes the gui, one guy who makes the logic, one guy who makes the database/data access, and so one.

For the question if managed is bad: if .Net is bad nobody would use it, there will be no jobs for programmers, Mono project is useless the same are all the tools available for .Net platform.
All are some stupid guys that instead of learning c++ or better c or even better assembly they develop languages, compilers and api and whatever useless stuff that is slow and bad for the mankindGrin. The same logic can be used for OpenGL debate and all other debates. But people are making money with these useless so those are not useless after all.
Was/Is Facebook done in c or c++?

I really don't know what kind of support should Microsoft provide for OpenGL. Is Microsoft providing drivers for my printer? But for my graphics card but for anything that doesn't belong to them? Why can't I read an ext3 partition in plain windows? It's quite an old standard. They support only the minimum, what they have to, because support means lost money and it's in balance with functionality.

Just read this I hope it will explain:
***************************************
Content of this section is hidden, You must be registered and activate your account to see this content. See this link to read how you can remove this limitation:

http://forum.civilea.com/thread-27464.html
***************************************


Don't want to be rude or something but think like this, since this thread started how many applications did you finished and how much of the actual thing is working? How much of the stuff you learned can be reused and for how long the knowledge will be valid.

Somewhere in '97 I was learning Turbo Pascal and I was happy to use graph library and to find and use a custom driver in order to have 1024x768 resolution (I think) in Dos and graph, some sort of vesa. Instead of the crt library which allowed only a text screen.
This is what it could be achieved with it:
***************************************
Content of this section is hidden, You must be registered and activate your account to see this content. See this link to read how you can remove this limitation:

http://forum.civilea.com/thread-27464.html
***************************************

Later I was replacing explorer.exe of win 95 with a custom made one, more nicer.

If I look back all that stuff is now completely deprecated (like programmers call it).

If you know there was Imeges can't remember the exact name, a structural analysis software written in fortran (solver) and basic (graphics) because basic had support for graphics like above.
I was able to run it on a HTC Athena in dosbox somewhere in 2008. And perform 2d analysis on a 10 story MRF structure.

Here for opengl control:
***************************************
Content of this section is hidden, You must be registered and activate your account to see this content. See this link to read how you can remove this limitation:

http://forum.civilea.com/thread-27464.html
***************************************


Anyway happy programming friend and keep us up to date with your progress. I quite enjoy what you're doing.
[-] The following 3 users say Thank You to LiviuM for this post:
  • Dell_Brett, mecheil.edwar, 3fan
Reply
#20
Dear Gents,

My learning curve is going like this,
After adding user interface by using Win32 API
and after using OpenGL to draw items (Lines ,points ,...)

Finally I understand one new problem ,
All C & C++ Code are not run time code
I mean your data during compiling time..
But to build a real program , you need to add run-time data during using program by the user..
at this moment I discovered one missing point..and I learn a great thing..
How to manage the Memory during Run time..
and I understand how to build the data during run-time
It is very simple..
during run time if you are using C you have to use memory allocate ..which will cut a new location in memory during run time ..
and if you are using C++ you will use "New" to do same function
Finally all data is built by very simple concept :
How to Store part of memory ,then how to know the address of this one By Using Pointer
then how to add next data by creating next pointer and so and so until you build all your data structure that you need..

My Last Step Now - But simple step - How to move data from file to meomery and also how to move data from memory to file .. it is easy..

So I found solution with C++ for this issue by using Template <Vector> as example

Any way..I think this is the last step to build my simple code haha..

The good news L will release my first trial program .. very simple very soon..
And I hope with my collegues we can develop this tool to do many engineering works ( strucutral design ) with simple graphic out.
[-] The following 1 user says Thank You to mecheil.edwar for this post:
  • elbarto_87
Reply


Possibly Related Threads...
Thread Author Replies Views Last Post
free discussion about Tekla, Autodesk, Bentley mecheil.edwar 5 2,483 04-05-2015, 05:08 AM
Last Post: Williams



Users browsing this thread: 1 Guest(s)