Dealing with heterogeneous structures
by Peter17

Dear Andreas,
2011/4/21 Andreas Kloeckner <lists(a)informa.tiker.net>:
>
> What you want to do is perfectly possible, just not in the way you
> think. :) First of all, each "Field" necessarily has to correspond to a
> scalar field. *But* you are free to make these variables up as you
> please, as long as you provide values for them at evaluation time. So
> instead of Field('material').mu, say Field('mu'), and then, at
> evaluation time, say
>
> op(arg1=value, **kwargs)
>
> where kwargs is a dictionary of these values. Fortunately, Python is
> flexible enough that you can easily make such a dictionary from whatever
> source, be it an object or whatever else.
>
> One caveat: Getting these variables into fluxes might be a bit
> cumbersome, as these are applied to a vector of scalar fields--thus
> each of them must have a numerical index, so you need a convention for
> packing them into a vector.
>
Thank you very much for those informations. I think I need a few more
details so I can make my code work. I have tried different
possibilities but I'm afraid I'm still thinking the wrong way, so,
there are things I still don't understand...
I have objects (material1, material2...) which contain the constants
(material1.C, material2.C, material1.mu, etc.) that I need to access
when calculating the fluxes. C is a 6x6 matrix.
1) Do I need to create a space-dependent function for each constant
(I'd like not to), or can I rely on Field() to make only "a reference
to the material object" be space-dependent?
i.e. Can I use this?
material_elements = {}
for key in materials.keys():
material_elements[key] = set(mesh_data.tag_to_elements[key])
def mat_val(x, el):
for key in materials.keys():
if el in material_elements[key]:
return key
raise ValueError, "Material not found for this element"
op = MyOperator(dim=dim,
mat_val = make_tdep_given(mat_val),
materials = materials,
...
)
And, then, materials[material].mu, materials[material].C
Or do I need a C_val, mu_val, etc.?
2) I have packed this in a vector, so, I have:
def __init__(self,
dim,
mat_val,
materials,
...
):
self.mat_val = mat_val
...
# In rsh:
constants = self.mat_val
return compiled_op_template(q=q,constants=constants,**extra_kwargs)
# ^^^^^ Is this right? I am not touching extra_kwargs...
# In op_template:
q = make_vector_field('q', dim+self.dimF[dim])
constants = make_vector_field('constants', 1)
material = constants
# In the flux calculation, I try to access materials[material].mu but I get:
TypeError: unhashable type: 'numpy.ndarray'
# Probably because:
print material
# Prints
[constants[0]]
# However, if I replace self.materials[material].mu by
self.materials[material[0]].mu, I get:
KeyError: Subscript(Variable('constants'), 0)
What am I doing wrong?
3) I have read http://wiki.tiker.net/Hedge/HowTo/DealingwithOperators
but I don't understand when exactly I have to use Field() and when I
can pass the values in function calls...
I'm sorry to disturb you about this, but I have spent a full week on
this without managing to have it work... I feel lost :)
Thanks in advance
Best regards
--
Peter Potrowl
8 years, 9 months

"staging" is no more
by Andreas Kloeckner

Hi all,
I've decided to retire the "staging" development model in hedge, opting
instead to go for the same (saner, IMO) way that I use in other
projects--simply have master be the main branch and develop major
changes in feature branches.
Hope this makes everyone's life less complicated.
Andreas
8 years, 10 months

Re: [Hedge] Install
by Andreas Kloeckner

On Tue, 24 May 2011 22:30:02 -0400, Paul Cazeaux <paul_cazeaux(a)brown.edu> wrote:
> Hey Andreas,
> I'm trying to install Hedge and I've ran into a minor problem - the command "install -D" does not exist on my mac,
> so I have trouble installing Boost.bindings. Do you have a quick fix for this ?
Simply copy the 'boost' folder into '~/pool/boost-numeric-bindings' or
wherever you've chosen to install this stuff. All 'install -D' does is
copy files while creating directories that might not exist.
Andreas
PS: I prefer questions on hedge to go to the hedge mailing list:
http://lists.tiker.net/listinfo/hedge
8 years, 10 months

Regression Check Failed
by Andreas Kloeckner

Hi there,
I'm sorry to report that the regression check failed.
Details are attached.
- Your guilty conscience
8 years, 10 months

Regression Check Failed
by Andreas Kloeckner

Hi there,
I'm sorry to report that the regression check failed.
Details are attached.
- Your guilty conscience
8 years, 10 months

Regression Check Failed
by Andreas Kloeckner

Hi there,
I'm sorry to report that the regression check failed.
Details are attached.
- Your guilty conscience
8 years, 10 months

Regression Check Failed
by Andreas Kloeckner

Hi there,
I'm sorry to report that the regression check failed.
Details are attached.
- Your guilty conscience
8 years, 10 months

Regression Check Failed
by Andreas Kloeckner

Hi there,
I'm sorry to report that the regression check failed.
Details are attached.
- Your guilty conscience
8 years, 10 months

Regression Check Failed
by Andreas Kloeckner

Hi there,
I'm sorry to report that the regression check failed.
Details are attached.
- Your guilty conscience
8 years, 10 months

Regression Check Failed
by Andreas Kloeckner

Hi there,
I'm sorry to report that the regression check failed.
Details are attached.
- Your guilty conscience
8 years, 10 months