SD1D icon indicating copy to clipboard operation
SD1D copied to clipboard

Compilation error

Open mikekryjak opened this issue 2 years ago • 4 comments

Problem: Compilation results in errors which I think are related to the new point source option.

Reproduction steps:

  • clone master branch
  • cmake . -B build
  • cmake --build /build/dir

Console dump: /ssd_scratch/SD1Dtest/sd1d.cxx:172:74: error: ambiguous overload for ‘operator=’ (operand types are ‘Field2D’ and ‘Options’) 172 | .doc("Source of electron density. In SI units of particles/m^3/s"); | ^ In file included from /ssd_scratch/SD1Dtest/external/BOUT-dev/include/field3d.hxx:31, from /ssd_scratch/SD1Dtest/external/BOUT-dev/include/difops.hxx:39, from /ssd_scratch/SD1Dtest/external/BOUT-dev/include/bout.hxx:41, from /ssd_scratch/SD1Dtest/external/BOUT-dev/include/bout/physicsmodel.hxx:40, from /ssd_scratch/SD1Dtest/sd1d.cxx:42: /ssd_scratch/SD1Dtest/external/BOUT-dev/include/field2d.hxx:171:13: note: candidate: ‘Field2D& Field2D::operator=(const Field2D&)’ 171 | Field2D & operator=(const Field2D &rhs); | ^~~~~~~~ /ssd_scratch/SD1Dtest/external/BOUT-dev/include/field2d.hxx:177:13: note: candidate: ‘Field2D& Field2D::operator=(BoutReal)’ 177 | Field2D & operator=(BoutReal rhs); | ^~~~~~~~ /ssd_scratch/SD1Dtest/sd1d.cxx:175:90: error: ambiguous overload for ‘operator=’ (operand types are ‘Field2D’ and ‘Options’) 175 | .doc("Source of pressure in SI units of Pascals/s. Multiply by 3/2 to get W/m3/s"); | ^ In file included from /ssd_scratch/SD1Dtest/external/BOUT-dev/include/field3d.hxx:31, from /ssd_scratch/SD1Dtest/external/BOUT-dev/include/difops.hxx:39, from /ssd_scratch/SD1Dtest/external/BOUT-dev/include/bout.hxx:41, from /ssd_scratch/SD1Dtest/external/BOUT-dev/include/bout/physicsmodel.hxx:40, from /ssd_scratch/SD1Dtest/sd1d.cxx:42: /ssd_scratch/SD1Dtest/external/BOUT-dev/include/field2d.hxx:171:13: note: candidate: ‘Field2D& Field2D::operator=(const Field2D&)’ 171 | Field2D & operator=(const Field2D &rhs); | ^~~~~~~~ /ssd_scratch/SD1Dtest/external/BOUT-dev/include/field2d.hxx:177:13: note: candidate: ‘Field2D& Field2D::operator=(BoutReal)’ 177 | Field2D & operator=(BoutReal rhs); | ^~~~~~~~ /ssd_scratch/SD1Dtest/sd1d.cxx:269:78: error: ‘field3D’ was not declared in this scope; did you mean ‘Field3D’? 269 | .doc("Neutral atom pressure source. SI units of Pa/s").withDefault(field3D(0.0)) | ^~~~~~~ | Field3D make[2]: *** [CMakeFiles/sd1d.dir/build.make:76: CMakeFiles/sd1d.dir/sd1d.cxx.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:139: CMakeFiles/sd1d.dir/all] Error 2 make: *** [Makefile:136: all] Error 2

mikekryjak avatar Aug 28 '22 18:08 mikekryjak

I think you need the following changes:

L172:

       NeSource = Options::root()["Ne"]["source"]
-         .doc("Source of electron density. In SI units of particles/m^3/s");
+         .doc("Source of electron density. In SI units of particles/m^3/s")
+         .as<Field2D>;
 
       PeSource = Options::root()["Pe"]["source"]
-         .doc("Source of pressure in SI units of Pascals/s. Multiply by 3/2 to get W/m3/s");
+         .doc("Source of pressure in SI units of Pascals/s. Multiply by 3/2 to get W/m3/s")
+         .as<Field2D>;

L268:

         PnSource = Options::root()["Pn"]["source"]
-          .doc("Neutral atom pressure source. SI units of Pa/s").withDefault(field3D(0.0))
+          .doc("Neutral atom pressure source. SI units of Pa/s").withDefault(Field3D(0.0))
           / (SI::qe * Nnorm * Tnorm * Omega_ci);

ZedThree avatar Aug 30 '22 12:08 ZedThree

I am also having similar compilation issues. I have implemented the fixes that you have suggested but receive the following error when I try to make:

Consolidate compiler generated dependencies of target sd1d
[ 11%] Building CXX object CMakeFiles/sd1d.dir/sd1d.cxx.o
/home/mbk513/SD1D/sd1d.cxx: In member function ‘virtual int SD1D::init(bool)’:
/home/mbk513/SD1D/sd1d.cxx:173:11: error: no match for ‘operator=’ (operand types are ‘Field2D’ and ‘<unresolved overloaded function type>’)
  173 |          .as<Field2D>;
      |           ^~~~~~~~~~~
In file included from /home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field3d.hxx:31,
                 from /home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/difops.hxx:39,
                 from /home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/bout.hxx:43,
                 from /home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/bout/physicsmodel.hxx:40,
                 from /home/mbk513/SD1D/sd1d.cxx:42:
/home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field2d.hxx:162:12: note: candidate: ‘Field2D& Field2D::operator=(const Field2D&)’
  162 |   Field2D& operator=(const Field2D& rhs);
      |            ^~~~~~~~
/home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field2d.hxx:162:37: note:   no known conversion for argument 1 from ‘<unresolved overloaded function type>’ to ‘const Field2D&’
  162 |   Field2D& operator=(const Field2D& rhs);
      |                      ~~~~~~~~~~~~~~~^~~
/home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field2d.hxx:163:12: note: candidate: ‘Field2D& Field2D::operator=(Field2D&&)’
  163 |   Field2D& operator=(Field2D&& rhs) noexcept;
      |            ^~~~~~~~
/home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field2d.hxx:163:32: note:   no known conversion for argument 1 from ‘<unresolved overloaded function type>’ to ‘Field2D&&’
  163 |   Field2D& operator=(Field2D&& rhs) noexcept;
      |                      ~~~~~~~~~~^~~
/home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field2d.hxx:169:12: note: candidate: ‘Field2D& Field2D::operator=(BoutReal)’
  169 |   Field2D& operator=(BoutReal rhs);
      |            ^~~~~~~~
/home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field2d.hxx:169:31: note:   no known conversion for argument 1 from ‘<unresolved overloaded function type>’ to ‘BoutReal’ {aka ‘double’}
  169 |   Field2D& operator=(BoutReal rhs);
      |                      ~~~~~~~~~^~~
/home/mbk513/SD1D/sd1d.cxx:177:11: error: no match for ‘operator=’ (operand types are ‘Field2D’ and ‘<unresolved overloaded function type>’)
  177 |          .as<Field2D>;
      |           ^~~~~~~~~~~
In file included from /home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field3d.hxx:31,
                 from /home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/difops.hxx:39,
                 from /home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/bout.hxx:43,
                 from /home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/bout/physicsmodel.hxx:40,
                 from /home/mbk513/SD1D/sd1d.cxx:42:
/home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field2d.hxx:162:12: note: candidate: ‘Field2D& Field2D::operator=(const Field2D&)’
  162 |   Field2D& operator=(const Field2D& rhs);
      |            ^~~~~~~~
/home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field2d.hxx:162:37: note:   no known conversion for argument 1 from ‘<unresolved overloaded function type>’ to ‘const Field2D&’
  162 |   Field2D& operator=(const Field2D& rhs);
      |                      ~~~~~~~~~~~~~~~^~~
/home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field2d.hxx:163:12: note: candidate: ‘Field2D& Field2D::operator=(Field2D&&)’
  163 |   Field2D& operator=(Field2D&& rhs) noexcept;
      |            ^~~~~~~~
/home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field2d.hxx:163:32: note:   no known conversion for argument 1 from ‘<unresolved overloaded function type>’ to ‘Field2D&&’
  163 |   Field2D& operator=(Field2D&& rhs) noexcept;
      |                      ~~~~~~~~~~^~~
/home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field2d.hxx:169:12: note: candidate: ‘Field2D& Field2D::operator=(BoutReal)’
  169 |   Field2D& operator=(BoutReal rhs);
      |            ^~~~~~~~
/home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field2d.hxx:169:31: note:   no known conversion for argument 1 from ‘<unresolved overloaded function type>’ to ‘BoutReal’ {aka ‘double’}
  169 |   Field2D& operator=(BoutReal rhs);
      |                      ~~~~~~~~~^~~
/home/mbk513/SD1D/sd1d.cxx:272:47: error: no match for ‘operator=’ (operand types are ‘Field2D’ and ‘Field3D’)
  272 |           / (SI::qe * Nnorm * Tnorm * Omega_ci);
      |                                               ^
In file included from /home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field3d.hxx:31,
                 from /home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/difops.hxx:39,
                 from /home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/bout.hxx:43,
                 from /home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/bout/physicsmodel.hxx:40,
                 from /home/mbk513/SD1D/sd1d.cxx:42:
/home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field2d.hxx:162:12: note: candidate: ‘Field2D& Field2D::operator=(const Field2D&)’
  162 |   Field2D& operator=(const Field2D& rhs);
      |            ^~~~~~~~
/home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field2d.hxx:162:37: note:   no known conversion for argument 1 from ‘Field3D’ to ‘const Field2D&’
  162 |   Field2D& operator=(const Field2D& rhs);
      |                      ~~~~~~~~~~~~~~~^~~
/home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field2d.hxx:163:12: note: candidate: ‘Field2D& Field2D::operator=(Field2D&&)’
  163 |   Field2D& operator=(Field2D&& rhs) noexcept;
      |            ^~~~~~~~
/home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field2d.hxx:163:32: note:   no known conversion for argument 1 from ‘Field3D’ to ‘Field2D&&’
  163 |   Field2D& operator=(Field2D&& rhs) noexcept;
      |                      ~~~~~~~~~~^~~
/home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field2d.hxx:169:12: note: candidate: ‘Field2D& Field2D::operator=(BoutReal)’
  169 |   Field2D& operator=(BoutReal rhs);
      |            ^~~~~~~~
/home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field2d.hxx:169:31: note:   no known conversion for argument 1 from ‘Field3D’ to ‘BoutReal’ {aka ‘double’}
  169 |   Field2D& operator=(BoutReal rhs);
      |                      ~~~~~~~~~^~~
/home/mbk513/SD1D/sd1d.cxx: In member function ‘int SD1D::precon(BoutReal, BoutReal, BoutReal)’:
/home/mbk513/SD1D/sd1d.cxx:1645:24: error: ‘Create’ is not a member of ‘InvertPar’
 1645 |       inv = InvertPar::Create();
      |                        ^~~~~~
make[2]: *** [CMakeFiles/sd1d.dir/build.make:76: CMakeFiles/sd1d.dir/sd1d.cxx.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/sd1d.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

Please let me know if any additional info would help!

matthewbkhan avatar Sep 05 '22 09:09 matthewbkhan

Oops, sorry, that should've been .as<Field2D>()!

On Mon, 5 Sep 2022, 10:11 Matthew Khan, @.***> wrote:

I am also having similar compilation issues. I have implemented the fixes that you have suggested but receive the following error when I try to make:

Consolidate compiler generated dependencies of target sd1d

[ 11%] Building CXX object CMakeFiles/sd1d.dir/sd1d.cxx.o

/home/mbk513/SD1D/sd1d.cxx: In member function ‘virtual int SD1D::init(bool)’:

/home/mbk513/SD1D/sd1d.cxx:173:11: error: no match for ‘operator=’ (operand types are ‘Field2D’ and ‘’)

173 | .as<Field2D>;

  |           ^~~~~~~~~~~

In file included from /home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field3d.hxx:31,

             from /home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/difops.hxx:39,

             from /home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/bout.hxx:43,

             from /home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/bout/physicsmodel.hxx:40,

             from /home/mbk513/SD1D/sd1d.cxx:42:

/home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field2d.hxx:162:12: note: candidate: ‘Field2D& Field2D::operator=(const Field2D&)’

162 | Field2D& operator=(const Field2D& rhs);

  |            ^~~~~~~~

/home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field2d.hxx:162:37: note: no known conversion for argument 1 from ‘’ to ‘const Field2D&’

162 | Field2D& operator=(const Field2D& rhs);

  |                      ~~~~~~~~~~~~~~~^~~

/home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field2d.hxx:163:12: note: candidate: ‘Field2D& Field2D::operator=(Field2D&&)’

163 | Field2D& operator=(Field2D&& rhs) noexcept;

  |            ^~~~~~~~

/home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field2d.hxx:163:32: note: no known conversion for argument 1 from ‘’ to ‘Field2D&&’

163 | Field2D& operator=(Field2D&& rhs) noexcept;

  |                      ~~~~~~~~~~^~~

/home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field2d.hxx:169:12: note: candidate: ‘Field2D& Field2D::operator=(BoutReal)’

169 | Field2D& operator=(BoutReal rhs);

  |            ^~~~~~~~

/home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field2d.hxx:169:31: note: no known conversion for argument 1 from ‘’ to ‘BoutReal’ {aka ‘double’}

169 | Field2D& operator=(BoutReal rhs);

  |                      ~~~~~~~~~^~~

/home/mbk513/SD1D/sd1d.cxx:177:11: error: no match for ‘operator=’ (operand types are ‘Field2D’ and ‘’)

177 | .as<Field2D>;

  |           ^~~~~~~~~~~

In file included from /home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field3d.hxx:31,

             from /home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/difops.hxx:39,

             from /home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/bout.hxx:43,

             from /home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/bout/physicsmodel.hxx:40,

             from /home/mbk513/SD1D/sd1d.cxx:42:

/home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field2d.hxx:162:12: note: candidate: ‘Field2D& Field2D::operator=(const Field2D&)’

162 | Field2D& operator=(const Field2D& rhs);

  |            ^~~~~~~~

/home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field2d.hxx:162:37: note: no known conversion for argument 1 from ‘’ to ‘const Field2D&’

162 | Field2D& operator=(const Field2D& rhs);

  |                      ~~~~~~~~~~~~~~~^~~

/home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field2d.hxx:163:12: note: candidate: ‘Field2D& Field2D::operator=(Field2D&&)’

163 | Field2D& operator=(Field2D&& rhs) noexcept;

  |            ^~~~~~~~

/home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field2d.hxx:163:32: note: no known conversion for argument 1 from ‘’ to ‘Field2D&&’

163 | Field2D& operator=(Field2D&& rhs) noexcept;

  |                      ~~~~~~~~~~^~~

/home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field2d.hxx:169:12: note: candidate: ‘Field2D& Field2D::operator=(BoutReal)’

169 | Field2D& operator=(BoutReal rhs);

  |            ^~~~~~~~

/home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field2d.hxx:169:31: note: no known conversion for argument 1 from ‘’ to ‘BoutReal’ {aka ‘double’}

169 | Field2D& operator=(BoutReal rhs);

  |                      ~~~~~~~~~^~~

/home/mbk513/SD1D/sd1d.cxx:272:47: error: no match for ‘operator=’ (operand types are ‘Field2D’ and ‘Field3D’)

272 | / (SI::qe * Nnorm * Tnorm * Omega_ci);

  |                                               ^

In file included from /home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field3d.hxx:31,

             from /home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/difops.hxx:39,

             from /home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/bout.hxx:43,

             from /home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/bout/physicsmodel.hxx:40,

             from /home/mbk513/SD1D/sd1d.cxx:42:

/home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field2d.hxx:162:12: note: candidate: ‘Field2D& Field2D::operator=(const Field2D&)’

162 | Field2D& operator=(const Field2D& rhs);

  |            ^~~~~~~~

/home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field2d.hxx:162:37: note: no known conversion for argument 1 from ‘Field3D’ to ‘const Field2D&’

162 | Field2D& operator=(const Field2D& rhs);

  |                      ~~~~~~~~~~~~~~~^~~

/home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field2d.hxx:163:12: note: candidate: ‘Field2D& Field2D::operator=(Field2D&&)’

163 | Field2D& operator=(Field2D&& rhs) noexcept;

  |            ^~~~~~~~

/home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field2d.hxx:163:32: note: no known conversion for argument 1 from ‘Field3D’ to ‘Field2D&&’

163 | Field2D& operator=(Field2D&& rhs) noexcept;

  |                      ~~~~~~~~~~^~~

/home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field2d.hxx:169:12: note: candidate: ‘Field2D& Field2D::operator=(BoutReal)’

169 | Field2D& operator=(BoutReal rhs);

  |            ^~~~~~~~

/home/mbk513/BOUT-configs/generic-4.4/BOUT-dev/include/field2d.hxx:169:31: note: no known conversion for argument 1 from ‘Field3D’ to ‘BoutReal’ {aka ‘double’}

169 | Field2D& operator=(BoutReal rhs);

  |                      ~~~~~~~~~^~~

/home/mbk513/SD1D/sd1d.cxx: In member function ‘int SD1D::precon(BoutReal, BoutReal, BoutReal)’:

/home/mbk513/SD1D/sd1d.cxx:1645:24: error: ‘Create’ is not a member of ‘InvertPar’

1645 | inv = InvertPar::Create();

  |                        ^~~~~~

make[2]: *** [CMakeFiles/sd1d.dir/build.make:76: CMakeFiles/sd1d.dir/sd1d.cxx.o] Error 1

make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/sd1d.dir/all] Error 2

make: *** [Makefile:91: all] Error 2

Please let me know if any additional info would help!

— Reply to this email directly, view it on GitHub https://github.com/boutproject/SD1D/issues/16#issuecomment-1236739157, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALLAXXKZCDGLOZXVLNH3BLV4W2KLANCNFSM573OO3WQ . You are receiving this because you commented.Message ID: @.***>

ZedThree avatar Sep 05 '22 09:09 ZedThree

Hi @mikekryjak and @matthewbkhan Sorry, these changes are all in a branch update-bout to be merged in PR #18 . That also enables Github automated tests, so should catch any changes which break compilation.

bendudson avatar Sep 06 '22 15:09 bendudson