Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
NIFTy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
10
Issues
10
List
Boards
Labels
Service Desk
Milestones
Merge Requests
8
Merge Requests
8
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ift
NIFTy
Commits
0f2f262e
Commit
0f2f262e
authored
Jul 24, 2018
by
Martin Reinecke
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add FieldAdapter
parent
c960121b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
0 deletions
+43
-0
nifty5/__init__.py
nifty5/__init__.py
+1
-0
nifty5/operators/field_adapter.py
nifty5/operators/field_adapter.py
+42
-0
No files found.
nifty5/__init__.py
View file @
0f2f262e
...
...
@@ -33,6 +33,7 @@ from .operators.domain_distributor import DomainDistributor
from
.operators.endomorphic_operator
import
EndomorphicOperator
from
.operators.exp_transform
import
ExpTransform
from
.operators.fft_operator
import
FFTOperator
from
.operators.field_adapter
import
FieldAdapter
from
.operators.field_zero_padder
import
FieldZeroPadder
from
.operators.hartley_operator
import
HartleyOperator
from
.operators.harmonic_smoothing_operator
import
HarmonicSmoothingOperator
...
...
nifty5/operators/field_adapter.py
0 → 100644
View file @
0f2f262e
from
__future__
import
absolute_import
,
division
,
print_function
from
..compat
import
*
from
.linear_operator
import
LinearOperator
from
..multi.multi_domain
import
MultiDomain
from
..multi.multi_field
import
MultiField
class
FieldAdapter
(
LinearOperator
):
def
__init__
(
self
,
op
,
name_dom
,
name_tgt
):
if
name_dom
is
None
:
self
.
_domain
=
op
.
domain
else
:
self
.
_domain
=
MultiDomain
.
make
({
name_dom
:
op
.
domain
})
if
name_tgt
is
None
:
self
.
_target
=
op
.
target
else
:
self
.
_target
=
MultiDomain
.
make
({
name_tgt
:
op
.
target
})
self
.
_op
=
op
@
property
def
domain
(
self
):
return
self
.
_domain
@
property
def
target
(
self
):
return
self
.
_target
@
property
def
capability
(
self
):
return
self
.
_op
.
capability
def
apply
(
self
,
x
,
mode
):
self
.
_check_input
(
x
,
mode
)
dom
=
self
.
_dom
(
mode
)
if
x
.
domain
is
not
dom
:
x
=
dom
.
values
()[
0
]
res
=
self
.
_op
.
apply
(
x
.
mode
)
tgt
=
self
.
_tgt
(
mode
)
if
res
.
domain
is
not
tgt
:
res
=
MultiField
(
tgt
,
(
res
,))
return
res
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment