Topic: Errors during VS compilation

After updating my local copy of oofem code from the git repo, I found 2 errors compiling with VS 2013:

1 -

error C2593: 'operator =' ambiguous    C:\oofemUPD\src\oofemlib\constantfunction.h    68    1    sm

the line of code is the following (commenting this line the compilation goes fine, but not sure if I can really comment it out):

virtual void evaluate(FloatArray &answer, const std :: map< std :: string, FunctionArgument > &valDict) { answer = {this->giveValue()}; }

2 - this is the most strange error to me, and it occurs a lot of time during compilation:

error C2280: 'std::unique_ptr<oofem::IntegrationRule,std::default_delete<_Ty>> &std::unique_ptr<_Ty,std::default_delete<_Ty>>::operator =(const std::unique_ptr<_Ty,std::default_delete<_Ty>> &)': tentativo di fare riferimento a una funzione eliminata    C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xutility    2045    1    sm 

I found this explanation, but for me it is not very useful ...

Finally, can the AbaqusUserElement code (that I submitted on another topic) be included in this release? It's still a bit experimental but I think it useful...
I cannot find also the referenceAngle added in beam3d ...

thanks for the help

Re: Errors during VS compilation

These are both compiler bugs in MSVC. The workarounds are:
1.
The fix is:
answer = FloatArray{this->giveValue()};


2.
The problem is that MSVC is implicitly adding operator= and copy ctors to classes that can't be trivially copied, like Domain.


Both of these are now fixed at http://www.github.com/Micket/oofem  (I just merged the pull request from a coworker who fixed a bunch of compilation errors and warnings with MSVC, including these two errors).



I haven't gotten around to include your patches yet.

Re: Errors during VS compilation

Thanks, from your git repo all goes fine.

Another thing:
I've also tried the compilation in VS2013 at 64bit, but there might be some libraries at 32bit that prevent the 64bit compilation.

Re: Errors during VS compilation

Dear Mikael,
in attachment the last (uncrustified) version of the UEL interface tested also for eigenValue analysis.
The patch have been done from sctrach for your convenience. I hope this will be included soon in OOFEM.

Thanks,
Giovanni

Post's attachments

UELmodalCorrection.zip 5.94 kb, 3 downloads since 2014-12-29 

You don't have the permssions to download the attachments of this post.

Re: Errors during VS compilation

Hi
I've included the code in my github repo now, and it will be merged into oofem.org eventually.

There was several things I had to change (would not compile), and much more things I wanted to change, such as broken doxygen comments, and the design of the code itself.

A few things that I don't know/understand, and I would like to ask you for further corrections to the code:

1. Why is
    this->nrhs = 2;

2. Why, if nrhs = 2, is DU the only input which has 2 columns? In the header file, it says nrhs = 1.

3. Are lFlags  always supposed to be of length 20?

4. Why is the energy hardcoded to size 8?

5. Why is predef sized with a multiple of 2? It is because mrcd == 2? In that case, we should use mrcd instead of hardcoding 2.


I had to rearrange quite a bit of code, so i might very well have introduced a bug somewhere. Please check to see if my version still works for you, as I'm unable to test it out.

Re: Errors during VS compilation

Hi Mikael,
thank you for your support. I suppose that the actual UEL code would not compile in your repo, this is because I still use the version of oofem code prior to your folder re-organization.

Most of your question are related to the conventions used in Abaqus:

1. nrhs is hardcoded to 2 to stay in the general case: if nrhs=2, it means that it's a Riks analysis (not sure if used in OOFEM). I corrected nrhs=2 in the .h file.

2. the second column of DU is for the imaginary parts in perturbation analysis. I leave it to 2 for generality.

3. no, this is a refure, sorry: LFLAGS has a dimension of 5.

4. because abaqus require to energy to be of length 8 (see PDF attached for description)

5. no, the first size of predef is fixed to 2. mcrd is a variable, defined as the maximum of the user-defined maximum number of coordinates needed at any node point, and the value of the largest active degree of freedom of the user element that is less than or equal to 3 (see attached PDF).

FInally, I tried to compile the code but this does not work for modal analysis (see latest post on that).
In the attachment, for your convenience, you can find an example routine and a test input deck.

thanks,
Giovanni

Post's attachments

Abaqus User Subroutines Reference Manual.zip 204.4 kb, 2 downloads since 2014-12-31 

You don't have the permssions to download the attachments of this post.

Re: Errors during VS compilation

I wanted to make sure the values where correct and general.

OOFEM has a arc length solver, but I can't quite see why the element response would need to differ, unless we talk about arc-length on Dirichlet b.c.s

The code compiles, but I don't have a abaqus user element to try out, nor any input files to use. I can't see why modal analysis wouldn't work now (that is, *only* modal analysis, not a 2-step analysis which isn't currently supported for any elements).
I need a stack trace to where it crashes/quits to determine why modal analysis isn't working for you.

8 (edited by johnnyontheweb 31-12-2014 17:54:58)

Re: Errors during VS compilation

In the zip file attached to my last post there is a user element to try the code.

EDIT: here you are the stack trace:

     oofem.exe!oofem::Domain::giveNode(int n) Riga 344    C++
     oofem.exe!oofem::Element::giveNode(int i) Riga 520    C++
>    oofem.exe!oofem::AbaqusUserElement::postInitialize() Riga 151    C++
     oofem.exe!oofem::Domain::postInitialize() Riga 1088    C++
     oofem.exe!oofem::EngngModel::postInitialize() Riga 1695    C++
     oofem.exe!oofem::EngngModel::instanciateDomains(oofem::DataReader * dr) Riga 350    C++
     oofem.exe!oofem::EngngModel::instanciateYourself(oofem::DataReader * dr, oofem::InputRecord * ir, const char * dataOutputFileName, const char * desc) Riga 275    C++
     oofem.exe!oofem::InstanciateProblem(oofem::DataReader * dr, oofem::problemMode mode, int contextFlag, oofem::EngngModel * _master, bool parallelFlag) Riga 76    C++
     oofem.exe!main(int argc, char * * argv) Riga 252    C++

Re: Errors during VS compilation

Hi Giovanni.

To get better help faster in the future, you need to help me out more.
( I want to emphasize that I'm not angry, though I might seem like it, I just need to be informative )

1. Saying that something doesn't work you need to include the exact error messages, and in most cases, a stack trace.
2. There has been many files posted, and I have a hard time keeping track of what is the latest and what I should be running. It would save me a lot of time if you can try to make your post as complete (self contained) with all the necessary files.
You need to supply a minimal input file, the user element (or a link to the exakt place) and instructions for how to compile the UEL.


Now, the input file i used to test things out

spring2.out
test for abaqus user element interface
#LinearStatic nsteps 1
EigenValueDynamic nroot 1 rtolv 1e-6
domain 3dShell
OutputManager tstep_all dofman_all element_all
ndofman 2 nelem 1 ncrosssect  1 nmat 1 nbc 3 nic 0 nltf 1
node 1 coords 3 0.  0.  0. bc 6 0 0 0 0 0 0 load 1 3 
node 2 coords 3 1.  0.  0. bc 6 0 0 0 0 0 0
#
abaqususerelement 1 nodes 2 1 2 coords 3 dofs 3 3 2 1 numsvars 52 properties 44 1.7846   23.7743   0.2283   27.7141   -0.2283   3.1666   0.75833   0.925   64   0.3   0.6   1   0   0.000253   -0.01833   0.56666   1.0666   1   0   10.0   10.0   0.3   19.268   23.7743   2.6995   19.268   0.40133   23.4716   -0.40133   2.1666   0.75   0.90833   24   0   0.8   -1000000   8   0.85   1   -0.30833   1   0   0.000253   1.5 type 3002 uel U1126F.dll
#
SimpleCS 1 area 0.1575 Iy 0.002657812 Iz 0.001607812 Ik 0.003606447115384616 beamShearCoeff 1.e30
IsoLE 1 d 1. E 25.e6 n 0.15 tAlpha 1.2e-5
BoundaryCondition  1 loadTimeFunction 1 prescribedvalue 0.0
ConstantEdgeLoad 2 loadTimeFunction 1 Components 6 0.0 0.0 3.0 0.0 0.0 0.0 loadType 3 ndofs 6
NodalLoad 3 loadTimeFunction 1 Components 6 0.0 0.0 15.0  0. 0. 0.
PeakFunction 1 t 1.0 f(t) 1.

Which i modified to run the eigenvaluedynamic instead.

The user element isn't trivial to compile in a dynamic library, so I don't have time to investigate that. Instead I commented out the actual loading of the UEL component, just to check that the postInitialize is working correctly.
And, as far as I can tell, it does load correctly.

Are you running your code in debug mode? Are you missing a node in your input file?
These are the only guesses I can make at this point.

10 (edited by johnnyontheweb 02-01-2015 22:19:13)

Re: Errors during VS compilation

I try to complete all the info needed:
1. to compile the DLL using gfortran, I used the same command for compiling UMAT dlls:

gfortran -shared -o UelAb.dll UelAb.for

The file ABA_PARAM.INC must be in the same directory as the source file. In attachment, the DLL file of the sample UEL previously sent.

2. The error obtained in oofem was:

Total number of solution steps     1
_______________________________________________________
Error: (c:\oofem\src\oofemlib\domain.h:344)
In Domain::oofem::Domain::giveNode, number: 1:
undefined dofManager (20001)
_______________________________________________________
No backtrace available
Total 1 error(s) and 0 warning(s) reported
oofem exit code 1

3. the error is obtained with the attached file (please consider it is underconstrained with the sample truss UEL I provided, it derives from a previous model made to work with my UEL springs which are different. So don't worry about results). I'm running in debug mode. Both the spring nodes are present in the model (node 20001 exists). The stack is the one I posted previously (sorry for my hurry there).

4. Your "spring2" file works but the nodal displacements are 1.#QNAN. I noticed that you used an old version of the UEL DLL (U1126F.dll) which contains some bugs. Anyway, this should not a problem for eigenValue analysis and I cannot figure out what's happening in the attached file instead. Better to always refer to UelAb.dll from now.

Thanks for your help and for your patience,
Giovanni

Post's attachments

modelEigenUEL.zip 49.36 kb, 1 downloads since 2015-01-01 

You don't have the permssions to download the attachments of this post.

Re: Errors during VS compilation

Hi Mikael,
in AbaqusUserElement :: postInitialize() I found your corrected code:

    if ( !this->coords.isNotEmpty() ) {
        this->coords.resize(this->numberOfDofMans, this->mcrd);
        for ( int j = 1; j <= numberOfDofMans; j++ ) {
            Node *dm = this->giveNode(j);
            for ( int i = 1; i <= mcrd; i++ ) {
                this->coords.at(i, j) = dm->giveCoordinate(i);
            }
        }
    }

I'm trying to understand why you corrected the internal for loops starting from 1 instead that from 0.

thanks,
Giovanni

Re: Errors during VS compilation

Most indexing start from 1 in OOFEM. Rather than doing "i+1" I just had i start from 1. Your version would have worked as well, I just rewrote the code to match what most of the other code in OOFEM looks like.

Now, the problem is
1. I don't have windows, so I can't use any DLLs.
2. I don't have abaqus so I don't have any ABA_PARAM.inc files

The problem with postInitialize had to do with node numbering ( something that http://www.oofem.org/forum/viewtopic.php?id=1507 would have fixed ).
It was a pretty obscure bug, caused by the parameter "numberOfDofMans" not matching the size of dofManArray when the local renumbering the nodes occur. I think "numberOfDofMans" should be removed, as to not keep duplicated (and possible mismatching) information stored (a common source of logic bugs).
It should be fixed now.

Re: Errors during VS compilation

Thanks for the support.
I noticed you had never downloaded the file  Abaqus User Subroutines Reference Manual.zip 204.4 kb which I posted previously. Inside it you can find:
- the file ABA_PARAM.inc
- the source file of the routine
- a test input deck
- and extract from the Abaqus manual.

Re: Errors during VS compilation

OK. Please let me know if there are any more problems and I will try to compile it.

15 (edited by johnnyontheweb 04-01-2015 20:03:36)

Re: Errors during VS compilation

The code works perfectly, thanks.

During the analysis with another file of mine (that will be difficult to post because it requires another UEL) oofem says many times:

_______________________________________________________
Warning: (zznodalrecoverymodel.C:192)
In ZZNodalRecoveryModeloofem::ZZNodalRecoveryModel::recoverValues:
some values of some dofmanagers undetermined
[106 351 440 442 ]
_______________________________________________________

From this last error message, is it possible to detect in which nodes this error happens? The numbers shown at the bottom are the internal numbering of the nodes (keep in mind that in my model I use a non-continuous node numbering)?

Re: Errors during VS compilation

Technically, you could count the lines in your input file, but that's tedious.
Instead of printing the local node number we should print the node label == global number.

I changed this now, let me know how it works out.

Re: Errors during VS compilation

Thanks, it works fine. I can read directly from the warning messages the involved nodes.

Re: Errors during VS compilation

Dear Mikael,
I want to inform you about another potential bug in code during compilation in VS. After pulling from your repo TODAY on another machine (at work), I get these strange error messages when I try to compile in VS2013:

Errore    5    error C2280: 'std::unique_ptr<oofem::InputRecord,std::default_delete<_Ty>>::unique_ptr(const std::unique_ptr<_Ty,std::default_delete<_Ty>> &)': tentativo di fare riferimento a una funzione eliminata    C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xmemory0    600    1    core
Errore    8    error C2280: 'std::unique_ptr<oofem::InputRecord,std::default_delete<_Ty>>::unique_ptr(const std::unique_ptr<_Ty,std::default_delete<_Ty>> &)': tentativo di fare riferimento a una funzione eliminata    C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xmemory0    600    1    sm
Errore    12    error C2280: 'std::unique_ptr<oofem::InputRecord,std::default_delete<_Ty>>::unique_ptr(const std::unique_ptr<_Ty,std::default_delete<_Ty>> &)': tentativo di fare riferimento a una funzione eliminata    C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xmemory0    600    1    core
Errore    13    error C2280: 'std::unique_ptr<oofem::InputRecord,std::default_delete<_Ty>>::unique_ptr(const std::unique_ptr<_Ty,std::default_delete<_Ty>> &)': tentativo di fare riferimento a una funzione eliminata    C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xmemory0    600    1    core
Errore    14    error C2280: 'std::unique_ptr<oofem::InputRecord,std::default_delete<_Ty>>::unique_ptr(const std::unique_ptr<_Ty,std::default_delete<_Ty>> &)': tentativo di fare riferimento a una funzione eliminata    C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xmemory0    600    1    core
Errore    27    error C2280: 'std::unique_ptr<oofem::InputRecord,std::default_delete<_Ty>>::unique_ptr(const std::unique_ptr<_Ty,std::default_delete<_Ty>> &)': tentativo di fare riferimento a una funzione eliminata    C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xmemory0    600    1    sm
Errore    28    error C2280: 'std::unique_ptr<oofem::InputRecord,std::default_delete<_Ty>>::unique_ptr(const std::unique_ptr<_Ty,std::default_delete<_Ty>> &)': tentativo di fare riferimento a una funzione eliminata    C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xmemory0    600    1    sm
Errore    1    error C2280: 'std::unique_ptr<oofem::ContactDefinition,std::default_delete<_Ty>> &std::unique_ptr<_Ty,std::default_delete<_Ty>>::operator =(const std::unique_ptr<_Ty,std::default_delete<_Ty>> &)': tentativo di fare riferimento a una funzione eliminata    C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xutility    2045    1    sm
Errore    2    error C2280: 'std::unique_ptr<oofem::ContactDefinition,std::default_delete<_Ty>> &std::unique_ptr<_Ty,std::default_delete<_Ty>>::operator =(const std::unique_ptr<_Ty,std::default_delete<_Ty>> &)': tentativo di fare riferimento a una funzione eliminata    C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xutility    2045    1    core
Errore    3    error C2280: 'std::unique_ptr<oofem::ContactDefinition,std::default_delete<_Ty>> &std::unique_ptr<_Ty,std::default_delete<_Ty>>::operator =(const std::unique_ptr<_Ty,std::default_delete<_Ty>> &)': tentativo di fare riferimento a una funzione eliminata    C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xutility    2045    1    core
Errore    4    error C2280: 'std::unique_ptr<oofem::ContactDefinition,std::default_delete<_Ty>> &std::unique_ptr<_Ty,std::default_delete<_Ty>>::operator =(const std::unique_ptr<_Ty,std::default_delete<_Ty>> &)': tentativo di fare riferimento a una funzione eliminata    C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xutility    2045    1    core
Errore    6    error C2280: 'std::unique_ptr<oofem::ContactDefinition,std::default_delete<_Ty>> &std::unique_ptr<_Ty,std::default_delete<_Ty>>::operator =(const std::unique_ptr<_Ty,std::default_delete<_Ty>> &)': tentativo di fare riferimento a una funzione eliminata    C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xutility    2045    1    core
Errore    10    error C2280: 'std::unique_ptr<oofem::ContactDefinition,std::default_delete<_Ty>> &std::unique_ptr<_Ty,std::default_delete<_Ty>>::operator =(const std::unique_ptr<_Ty,std::default_delete<_Ty>> &)': tentativo di fare riferimento a una funzione eliminata    C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xutility    2045    1    core

It seems to me that these errors are not very useful to understand what happened, as they referred to xutility and xmomery0, which are some files provided by the C++ VS compiler.
The only difference from what I did in the past is to select USE_SHARED_LIB = ON.

Re: Errors during VS compilation

This is due to the MSVC compiler that adds a default copy compiler (I don't think it should), for classes that can't be copied (any class with a unique_ptr cannot be copied).

The workaround is to explicitly remove the copy ctor, and operator=

E.g.

    Domain(const Domain& src) = delete;
    Domain &operator = (const Domain &src) = delete;

(or actually implement them if they are needed).

I have done so to contactdefinition now.



I'm not sure about

Errore    28    error C2280: 'std::unique_ptr<oofem::InputRecord,std::default_delete<_Ty>>::unique_ptr(const std::unique_ptr<_Ty,std::default_delete<_Ty>> &)': tentativo di fare riferimento a una funzione eliminata    C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xmemory0    600    1    sm

though. None of the input records use any unique_ptr's, and no other class uses a unique_ptr of InputRecords either, so I'm not sure where things have gone wrong.

I need to know hwich file in OOFEM caused the problem (because, despite what MSVC says, the *actual* error is that something is trying to copy a unique_ptr, and *not* that unique_ptrs are non-copyable as these error messages say).

Re: Errors during VS compilation

ok, I understood; pulling again from your git I get the same errors (but you said that contactdefinition was corrected).

Anyway, I'll try the way you said. I searched for "&operator", the first is in dictionary.C:

std :: ostream &operator << ( std :: ostream & out, const Dictionary & r )

what is the correct correction here?

Re: Errors during VS compilation

Can you make sure that you have

    ContactDefinition(const ContactDefinition& src) = delete;
    ContactDefinition &operator = (const ContactDefinition &src) = delete;

and make sure that you don't get *exactly* this message anymore

Errore    1    error C2280: 'std::unique_ptr<oofem::ContactDefinition,std::default_delete<_Ty>> &std::unique_ptr<_Ty,std::default_delete<_Ty>>::operator =(const 

No, "&operator" is not the problem. "operator=" is. But, you cannot search for this, because it doesn't exist.
MSVC is adding this "operator=" and copy ctor implicitly. (MSVC is an awful compiler)
So, instead, we have to explicitly delete these to work around this.

22 (edited by johnnyontheweb 07-01-2015 16:39:11)

Re: Errors during VS compilation

I have both the lines in contactdefinition.h.

I get this exact error during compilaton.

EDIT: this attachment can be more useful to track the errors.

Post's attachments

logVScompilation.txt 88.44 kb, 2 downloads since 2015-01-07 

You don't have the permssions to download the attachments of this post.

Re: Errors during VS compilation

The relevant lines of errors are drowned out by irrelevant messages, so it's difficult to see what has gone wrong.

The relevant parts are just the few lines like this:

C:\oofem-micket\oofem\src\oofemlib\dynamicdatareader.h(92):

which tells me that MSVC is trying to add an implicit copy ctor to dynamicdatareader.

I fixed the two errors that was actually in the log you posted, but I'm betting there will be more.

Re: Errors during VS compilation

All errors are gone, thank you!

Re: Errors during VS compilation

Mikael, I just want to warn you about some errors in DSS compiling in VS with the last source from your git:

Errore    1    error C2027: utilizzo di tipo non definito 'oofem::Dof'    C:\oofemM\oofem\src\dss\dssmatrix.C    224    1    dss
Errore    2    error C2227: l'elemento a sinistra di '->isPrimaryDof' deve puntare a un tipo classe, struttura, unione o generico    C:\oofemM\oofem\src\dss\dssmatrix.C    224    1    dss
Errore    3    error C2027: utilizzo di tipo non definito 'oofem::Dof'    C:\oofemM\oofem\src\dss\dssmatrix.C    225    1    dss
Errore    4    error C2227: l'elemento a sinistra di '->giveEquationNumber' deve puntare a un tipo classe, struttura, unione o generico    C:\oofemM\oofem\src\dss\dssmatrix.C    225    1    dss
Errore    5    error C2027: utilizzo di tipo non definito 'oofem::Dof'    C:\oofemM\oofem\src\dss\dssmatrix.C    251    1    dss
Errore    6    error C2227: l'elemento a sinistra di '->isPrimaryDof' deve puntare a un tipo classe, struttura, unione o generico    C:\oofemM\oofem\src\dss\dssmatrix.C    251    1    dss
Errore    7    error C2027: utilizzo di tipo non definito 'oofem::Dof'    C:\oofemM\oofem\src\dss\dssmatrix.C    252    1    dss
Errore    8    error C2227: l'elemento a sinistra di '->giveEquationNumber' deve puntare a un tipo classe, struttura, unione o generico    C:\oofemM\oofem\src\dss\dssmatrix.C    252    1    dss